When creating a file pointer should I initialize it to NULL
or should I leave it uninitialized?
I currently have FILE* img;
. I think the better practice is to have FILE* img = NULL;
so it it doesn't store a garbage value. However, I seem to get an error when doing this.
Any thoughts?
EDIT
FILE* img;
while (fread(&buffer, BLOCK, 1, inptr) != 0)
{
// do stuff
if (beginning of file)
{
img = fopen(title, "a");
}
}
fclose(img);