Here is the code:
PHP Code:
inFile = fopen("serefs.dat","rb");
outFile = fopen("tempfile.dat","wb");
while (!feof(inFile))
{
char line[512];
char timeline[11];
fgets(line,512,inFile);
strncpy(timeline, line, 10);
timeline[11] = '\0';
int filetime;
filetime = atoi(timeline);
if(filetime > (realtime - 86400))
{
fputs(line,outFile);
}
}
fclose(inFile);
fclose(outFile);
//Put tempfile in buffer
inFile = fopen("tempfile.dat","rb");
fseek (inFile , 0 , SEEK_END);
size2 = ftell (inFile);
rewind (inFile);
buffer = (char*) malloc (size2);
fread (buffer,1,size2,inFile);
fclose (inFile);
//Copy buffer to serefs.dat
outFile = fopen("serefs.dat","wb");
if(outFile != NULL)
{
fputs(buffer,outFile);
}
free (buffer);
fclose(outFile);
Now I know I can add a counter, then add a condition to only copy tempfile to serefs if counter is not equal to 0. But that wouldn't satisfy my curiosity as to why those weird characters happen. Here is an example. "0 @0 @"
This ONLY happens *after* the file has already been opened once with no modifications.

