i know it can tell that but if you press the x button in a console app wouldnt the OS close any files being opened by that console??(that is if u forgot to write fclose(file) at the end of the program)
i mean this thing can make a comp go crazy and none of the existent OS have something against it. Somekind of a program that is called whenever another program is closed to make sure that all files who were needed to run that ,alrdy closed off, app being closed.
i just feel that this is a major defect in evry OS (not that i would write them better because i cant but i stumbled on this one a month ago and kept on thinking about it)
i dont know if you have ever tried something like this...
be my guest
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *garbage;
garbage=fopen("garbage.txt","a+");
if(garbage==0){
printf("Error\n");
exit(-1);
}
while(1){
fprintf(garbage,"000000000000000000000000000000000000000000000000000");
}
return 0;
}
notice i didnt used an fclose(garbage);
::note::
if u run this be sure to keep on checking how big the file garbage.txt is becoming....