comp.lang.c
[Top] [All Lists]

Re: fgets() and fopen() with "w"

Subject: Re: fgets() and fopen() with "w"
From: Walter Roberson
Date: Tue, 1 Apr 2008 22:13:42 +0000 UTC
Newsgroups: comp.lang.c

In article <fb279095-7574-40d1-9ce7-189818769123@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
 <vippstar@xxxxxxxxx> wrote:
>What happends if I try to read from a stream which has been opened
>with "w" mode, either with fgets or some other function?

fgets, C89:

  If a read error occurs during the operation, the array contents
  are indeterminate and a null pointer is returned.

Some of the other functions return EOF instead of a null pointer,
or return an unusual count -- depends on the exact function.


-- 
  "Let me live in my house by the side of the road --
   It's here the race of men go by.
   They are good, they are bad, they are weak, they are strong
   Wise, foolish -- so am I;"                 -- Sam Walter Foss

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy