As you can see, the value of buffer changes when the line
sprintf(tittle, %03d.jpg", images);, which has nothing to do with the buffer. All of the values in buffer are changed. I went through my code a thousand times, and I finally found out this. It's really frustrating! Any explanations?