This is an odd one. I've managed the get the code to work and output all 50 jpgs as expected with the exception of the first one. It's creating the file but not naming it correctly (not even adding .jpg onto the end) but if I rename it I can see it as the expected photo.
I've run the code through gdb and I'm still confused. 'num' is iterating as expected but the filenames are being named as if it's num - 1. On the first pass gdb says that num = 0 but the filename doesn't output correctly at all.
Hope that makes sense to someone?
The relevant code is:
if (jpgout == NULL)
{
jpgout = fopen(title, "w");
sprintf(title, "%03d.jpg", num);
num++;
}
else
{
fclose(jpgout);
jpgout = fopen(title, "w");
sprintf(title, "%03d.jpg", num);
num++;
}
[EDIT: irrelevant code removed.]