I've been staring at this for days and can't seem to find what's wrong. My code compiles, makes a file for the JPG's found, only doesn't show the JPG's but a weird screen full of symbols in white and red. I feel like I'm pretty close, but I can't find what I did wrong. I've also added part of the output. Please help!
// declare all variables
int pictures = 0;
FILE* img = NULL;
int imgopen = 0;
char filename[10];
{
//first JPG
if (imgopen == 0)
{
sprintf(filename, "%03d.jpg", pictures);
img = fopen ("filename", "w");
fwrite (buffer, 512, 1, img);
imgopen++;
}
Out of academic honesty, I've removed the irrelevant pieces of my code, and only left the part where I made a mistake.