Re: close(writefile)
- Posted by useless_ Dec 20, 2012
- 1200 views
jimcbrown said...
eukat said...
But -1 is an error flag. A file being closed isn't an error
That's a good point. However, 0 is a valid file handle and normally represents stdin.
In the nix world, you can actually close stdin and later reuse the zeroth file handle when opening up a new file (for reading or writing, or both).
Maybe it should return -2, or 0.1 ?
Can you write to stdin? If variable_name "writefile" is set to stdin, it's still not an open write_file, and i must open() (assign a valid write file handle) to it. The code i'd write to test it being zero isn't broken by nix saying it's pointed to stdin, it still tells me it's not an open writing file.
useless