Hello,
I'm writing a brute-force program for enumerating a certain kind of integer sequence (not important what this sequence actually is).
In order to get my results, I create a file and I'd like to write all program output to this file. However, it seems that the file "stagnates" at 524 kb even if the program should write something into it. I.e. the file is continously written until a file size of 524,0 kb is reached, then nothing more is written into the file.
I know that something should be written to the file because everytime I write something to this file, I printf
a message on screen so that I know something is going on.
I am using C (pretty low-level, i.e. only including stdio.h
, stdlib.h
, time.h
, string.h
) on ubuntu 10.04.
I create the file the following way:
time_t rawtime;
char timeStamp[20];
struct tm* clocktime;
time(&rawtime);
clocktime = localtime (&rawtime);
strftime (timeStamp, 20, "%Y%m%d_%H%M%S", clocktime);
char dimStamp[80];
sprintf(dimStamp, "d%dl%d_", DIMENSION, MAXDEPTH);
strcat(dimStamp, timeStamp);
strcat(dimStamp, ".txt");
FILE *output = fopen(dimStamp, "w");
Has anybody encountered a similar problem and/or does anybody know what this could come from?
Edit:
Could it be that output to a file in C is somewhat asynchronous, i.e. that I have to flush a buffer or something in order to get the file written instantly?