delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/24/04:45:24

From: "Aleksey Kondratyev" <akondra AT no-spam-mv DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ifstream error - Please help
Date: Wed, 24 Jun 1998 11:34:19 +0400
Organization: Middle Volga Communication service
Lines: 36
Message-ID: <6mqagp$gim$1@simtel.ru>
References: <6mpqen$a6h$1 AT news DOT bctel DOT net>
Reply-To: "Aleksey Kondratyev" <djgpp AT delorie DOT com>
NNTP-Posting-Host: ppp13.usr.mv.ru
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> In the following code, when I attemp to load a 24bit, 320*200 file and
place
> on the screen it returns after puting only about 750 pixles.  Also I know
> this because if I skip the eof() test it will make 90% of the screen
white.
> (could be lightest gray).  The file that I am loading is one saved by PSP
4
> in the RAW format ( 24bit, ordered, not flipped RRGBRGBR...)

> void Raw::Load(char * Name, int dx = 320, int dy = 200, int tx=0, int
ty=0)
> {
>         char r,g,b,rgb;
>         ifstream temp(Name);

Try some like 'ifstream temp(Name,ios::in|ios::binary);' The stream is
opened in text mode
by default (perhaps, this default behavior can be changed) and the first
occurence of
0x26 (to my mind) code is considered as eof. If you insist to read the
stream even if
the ifstream object thinks that it is eof, -1 value is returned and looks as
lightest gray
(white) on the screen.

----------------------------------------------------------------------
Aleksey Kondratyev
Ph.D. student of Ulyanovsk state University, Russia
http://www.mv.ru/~akondra
E-mail akondra AT mmf DOT univ DOT simbirsk DOT su
           akondra AT mv DOT ru
If the  address above contains no-spam-, please,
remove it when replying.



- Raw text -


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