Writing to files from C functions
Scott Barron
sbarron at twilight.
Fri Nov 5 23:14:20 EST 1999
Hi folks,
I have a C library with a couple of functions along these lines:
int foo (int d, int v)
{
fd = fopen ("logfile.log", "a");
fprintf ("called foo on %d with arg %d\n", d, v);
fflush (fd);
fclose (fd);
return 0;
}
I have used SWIG to generate wrappers for this library and all is mostly
well. However, I'd like to 'tail -f' the log file while im in the Python
interactive interpreter but the data isn't written to the file until I
exit the Python interpreter. Is Python not actually flushing my file as
I ask or is my C code incorrect?
Thanks,
Scott
More information about the Python-list
mailing list