www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/17/12:03:19

Newsgroups: comp.os.msdos.djgpp
From: fredex AT fcshome DOT stoneham DOT ma DOT us (Fred Smith)
Subject: Re: Fopen() and EOF
Organization: None!
Message-ID: <ErInwu.770@fcshome.stoneham.ma.us>
References: <6h2ljv$72g$1 AT hiisi DOT inet DOT fi>
Date: Thu, 16 Apr 1998 17:14:54 GMT
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Henri Ossi (henri DOT ossi AT mail DOT htk DOT fi) wrote:

: I'm trying to read a pic, which is raw data. (pixel color from 0 to 255)
: So the pixel color is used as the ASCII number.

: But if the pixel is 26, fopen reads the character, which is Ctrl-Z, as EOF.

: There must be a way to round this.
: Re-define EOF?
: Maybe inline asm?
: Or other file reading functions?

No, just make sure you open the file in BINARY mode:

	char buf[WHATEVER];
	FILE * foo;
	foo = fopen (buf, "rb");
	                   ^^

Fred
--
---- Fred Smith -- fredex AT fcshome DOT stoneham DOT ma DOT us -----------------------------
  "And he will be called Wonderful Counselor, Mighty God, Everlasting Father,
  Prince of Peace. Of the increase of his government there will be no end. He 
 will reign on David's throne and over his kingdom, establishing and upholding
      it with justice and righteousness from that time on and forever."
------------------------------- Isaiah 9:7 (niv) ------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019