home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: chang.unx.sas.com!walker
- From: walker@chang.unx.sas.com (Doug Walker)
- Subject: Re: Get file handle from file descriptor? (SAS/C)
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <DnEsBw.o0@unx.sas.com>
- Date: Tue, 27 Feb 1996 00:35:56 GMT
- X-Nntp-Posting-Host: chang.unx.sas.com
- References: <67478443@porky.apl.s.shuttle.de>
- Organization: SAS Institute Inc.
-
- In article <67478443@porky.apl.s.shuttle.de>,
- Andreas Voegele <andreas@porky.apl.s.shuttle.de> wrote:
- >How can I get the AmigaDOS file handle that is associated with a file
- >descriptor? I need to Examine() a file opened with open().
-
- __chkufb(fd)
-
- or if you have a file opened with fopen()
-
- __chkufb(fileno(fp))
-
- >BTW, why does open("plainfile", 0) return 0 when using SAS/C?
- >Aren't the descriptors 0, 1 and 2 reserved for standard input,
- >standard output and standard error?
-
- 0, 1, and 2 are stdin, stdout and stderr if and only if you
- actually USE stdin, stdout, or stderr. If you do not use them
- by name, only by number, we cannot tell that you want them and
- we don't allocate them for you.
-
- The easiest way to force us to include stdin, stdout, and stderr
- is to include the following declaration somewhere in your code
- (either as an extern or as a global):
-
- FILE *dummy = stdin;
-
- This will generate a reference to stdin and pull in the
- autoinitializers for stdin, stdout, and stderr.
-
- --
- ***** / walker@unx.sas.com
- *|_o_o|\\ Doug Walker< BIX, Portal: djwalker
- *|. o.| || \ AOL: weissblau
- | o |//
- ======
- Any opinions expressed are mine, not those of SAS Institute, Inc.
-
-