-
win 9x!!!....win xp ??
k long time ago i made a dos app in C.
it was on a win9x OS and the program checked if there was a command in the system.ini file, if not he would make one else it would skip the adjustment of the .ini file.
By doing this u only had to run this prog once and the rest of the time it would startup when u started windowse 9x.
Now the program opened a file using fopen("blabla.txt","a+");
at the end i didnt fclosed it. And in the program was a while loop (infinite one)
while(1){
this would make sure that data was constantly being written away to text files..... Now you would aspect an abortion of data transmission and writing when the app is manually closed.... (somekind of an emergency flcose by the OS).
But now what happened the app was closed and it was still writing data to the text file(if you pressed alt-ctrl-delete then it wasnt to see anywhere so it was really really closed of). At a certain moment i noticed that the comp was going awfully slow (that was after 30 after i had closed the app). I went looking to the txt file were data was written to by the prog. And after those 30 sec approx it was already 350 MB big.
This was done in win9x (os didnt gave any warning)
I also did this in xp (without using system.ini) and it gave me an error that there was not enough virtual memory....
Xp did gave a warning BUT none of the tested OS's automatically closed the txt file (that was increasing enormesly with the second)
Isnt this some sort of a leak in stabilty of the system ??
-
if you peeps want i want to include the source code so you can all seek it out urself ......
ive made a quick calculation
by opening this program once: u get 250Mb*2*60=30000
so within an hour that comp will have 30 GB less.... not to mention virtual memory (because of no Harddisk space available)...
-
What's the use exactly?;)
I don't think XP likes it when a pogram is constantly running,
even started before its boot, Maybe it doesnt like the program
eating memory? WinXP has its own will you know?
-
there isnt a use of it im just saying that this app that is only 30 kb big can mess up ur comp.
it just amazed me that all those fancy OS dont have any built-in security against this.
i bet if you saw what it did to a comp u would think the same as me.
-
The OS can't tell whether the file being written is garbage or not. In your case, it would be garbage, but if you unzip a 800Mb winzip file, it wouldn't...
-
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....