Re: [Lit.] Buffer overruns

From: Bryan Olson (nameless_at_nowhere.org)
Date: 01/27/05


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


Relevant Pages

  • Re: [Lit.] Buffer overruns
    ... >> character in a binary file. ... Thus the getc() function can return ... > getc returns an int, ...
    (sci.crypt)
  • Steamband Headgear
    ... make that mistake this time... ... A character dump, ... Hafted Weapons 1 ... telekinetic, 15% spirit, blindness and confusion resistance, see ...
    (rec.games.roguelike.angband)
  • Re: replacing text data in a binary file
    ... For a binary file, it really depends on the encoding, which I would try to ... If you start using ReadChar & WriteChar you are back to translating to Text. ... Assuming your file is not EBCDIC & you are not using any extended character ... EBCDIC you still have 1 byte per single character however ...
    (microsoft.public.dotnet.languages.vb)
  • Re: search and replace in binary file
    ... character, tab, etc. Looks like I can't attach files here, so best I can ... Dim objNetwork, objWMIService, objComputer, objFSO, objTextFile ... Dim strComputer, strUser, strUserProfilePath, strNextLine, strFileText ... 'OPTIONAL METHOD FOR DEALING WITH BINARY FILE, ...
    (microsoft.public.scripting.vbscript)
  • Re: TMA Assembler?
    ... That's the funny ... Difference between a binary file and a character file... ... and be able to criticize people basing your argumentation on something ...
    (alt.lang.asm)

Quantcast