www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/03/22/11:17:06

Xref: news2.mv.net comp.os.msdos.djgpp:2056
From: jtsilla AT ccs DOT neu DOT edu (James Tsillas)
Newsgroups: comp.os.msdos.djgpp
Subject: Is this a bug with open() (V2).
Date: 18 Mar 1996 14:23:44 GMT
Organization: Northeastern University
Lines: 32
Distribution: world
Message-ID: <JTSILLA.96Mar18092345@everest.ccs.neu.edu>
NNTP-Posting-Host: everest.ccs.neu.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi world,

I'm trying to create a file with the open system call and it appears to
succeed, returning a file descriptor greater than or equal to zero.
Errno is set to the "file doesn't exist" which appears to be normal. I
am using the CREAT flag and file gets created, etc. Now, it appears that
my file descriptor (returned from open) is 0. And (even more weird) when
I try to write to this file, the output goes to the terminal and the
file isn't written to. I recall that 0 was the standard fd for stdin in
POSIX.

Shouldn't open() return an unused fd? I wish I could give the precise
source but my source is on a different computer. One point to take note
of: I create the file as write only.

Is this a bug? If not, can I see a working example? If so, is there a
workaround? Nothing in the FAQ.

ciao,
-Jim.
--
  
 ____***___
 \..*...*./
  \.*..../
   \*...*  * Jim Tsillas - Senior Software Engineer     *
    \**/   * Cascade Communications Corp.               *
     \/    * 5 Carlisle Road, Westford MA 01886         *
   CASCADE
	

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019