
On Wednesday 16 April 2008 6:16:56 pm Brandon S. Allbery KF8NH wrote:
On Apr 16, 2008, at 17:30 , John Goerzen wrote:
On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote:
I already found this link. Thanks in any case. I want to O_CREATE a file, i.e. do a openFd creating a new file. O_CREATE should be the FileMode, but I don't see in the link below.
Indeed. It seems there is no way to pass O_CREAT to openFile. there is createFile, but that's really a different call. Sigh.
Remember, Haskell is functional; treat the function to call as an argument?
I don't have access to the GHC source just at the moment, but presumably that is an interface to creat() instead of open(). creat() is documented as: creat() is equivalent to open() with flags equal to O_CREAT|O_WRONLY|O_TRUNC. There could be reasons that you would want to pass, say, O_CREAT|O_RDWR| O_APPEND and omit O_TRUNC. There are also reasons that you might want to pass, say, O_WRONLY|O_APPEND with no O_CREAT. The fact that openFile implies O_CREAT sometimes is a serious misfeature IMHO. That means bug. -- John