I just used the class BufferedWriter (Java) and I noticed that the output is not flushed if you don't close the file explicitly. I think that the destructor should take care of flushing its buffers at exit.
result = new BufferedWriter(new FileWriter ("/tmp/somefile"));
result.write("something");
result.newLine();
result.close(); // We need this line!
Isn't it weird? I guess people get used to this fact.
#!/usr/bin/env python
f = open('/tmp/somefile', 'w')
f.write('bye')
In CPython this file gets written even if I don't do the f.close().
Last update: 2007-04-25 (Rev 11164)


