Slimelite BBS

Re: C File I/O - Pre Def Str

Back to R25C

From Ian James Abbott · 1996-04-09 07:34 · #75278 in R25C

In reply to C File I/O - Pre Def Str by Matthew Probert

From: jambo@spuddy.mew.co.uk (Ian James Abbott)

Yo Matthew!
>ANSI C specifies five standard streams which are defined in stdio.h, and are
>opened by C programs automatically when they commence execution. These five
>streams are; 'stdin', 'stdout', 'stderr', 'stdprn' and 'stdaux'.

ANSI C only defines 'stdin', 'stdout' and 'stderr'.

>stderr is not redirectable by the operator, and so the C programmer knows
>where the output from fprintf() calls to the stderr stream will go. They
>will go to the VDU unless the programmer tells the program to do otherwise.

Standard error output is redirectible under UNIX.

>This leads us on nicely to another ANSI C file I/O function provided in the
>standard C library. freopen() allows an already open stream to be redirected
>to a specified file with specified access. It has the prototype;
>
>      FILE *freopen(const char *name, const char *access, FILE *stream);

'mode', not 'access'.

-- 
  * Meeeow! Call Spuddy on +44 1268 515441 for FREE mail & Usenet access. *
--- ifmail v.2.8c
 * Origin: Spud's Public Usenet Domain (2:257/108.12@fidonet)