I am creating a new file and then using print in a loop to write lines of text to a file. However, I am also then checking to see if any lines have previously been written to that file using -s. This test always says that the file is zero size even if I have just used print to write a line into it. When I check the file it is indeed empty until the script has finished when there are multiple lines in the file.
What I want to know is, does print only write to the file once the filehandle is closed? How can I write data into a file and (before closing it) test to see if data has already been written?
Many thanks for your help,
Marc
In reply to Does print() write immediately to a file? by marctwo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |