Re: [Lit.] Buffer overruns
From: Bryan Olson (nameless_at_nowhere.org)
Date: 01/27/05
- Next message: Felix Rawlings: "Re: Math society, weird behavior"
- Previous message: Anne & Lynn Wheeler: "Re: [Lit.] Buffer overruns"
- In reply to: Phil Carmody: "Re: [Lit.] Buffer overruns"
- Next in thread: Douglas A. Gwyn: "Re: [Lit.] Buffer overruns"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 27 Jan 2005 20:16:37 GMT
Phil Carmody wrote:
>>EOF is -1 by tradition (the standard requires it to be some
>>negative value). When type char is signed, -1 is also a legal
>>character in a binary file. Thus the getc() function can return
>>-1 in two very different cases: end of file, or the -1
>>character. The code above assumes any return of EOF means end-
>>of-file.
>
>
>
> <<<
> 7.19.7.1 The fgetc function
[...]
> the fgetc function obtains that character as an
> unsigned char converted to an int and advances the
> associated file position indicator for the stream (if
> defined).
O.K. My mistake again. Again H&S seems to indicate otherwise.
-- --Bryan
- Next message: Felix Rawlings: "Re: Math society, weird behavior"
- Previous message: Anne & Lynn Wheeler: "Re: [Lit.] Buffer overruns"
- In reply to: Phil Carmody: "Re: [Lit.] Buffer overruns"
- Next in thread: Douglas A. Gwyn: "Re: [Lit.] Buffer overruns"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|