So hopefully I won't be bothering anyone for help and advice till I have something to show.
Well it seems that I was wrong.
I have got through a lot and nearing first release. However I have hit a wall.
My code was getting too long and difficult to read so I decided to separate it into extra files.
I have created .h files and put includes to them in the .c files. I have got externs for when I want to share variables across pages and everything compiles fine.
Yet I keep getting crashes.
I have narrowed it down to if commands not working.
In the main file if I have
FILE * fp;
file = fopen("new_file","w");
if(fp){
printf("file open");
fclose(fp);
}
printf("file closed");
The output as you would expect is
-file_openfile closed
If the same code is placed in one of the sub files the output is
-file closed
and then when I close the program I get an error because the file wasn't closed.
Any ideas what I've missed ?