From: ranla AT post DOT tau DOT ac DOT il (Tal Lavi) Newsgroups: comp.os.msdos.djgpp Subject: HELP!!! I/O in DJGPP! Date: Sun, 1 Nov 1998 12:36:31 LOCAL Organization: Tel-Aviv University Computation Center Lines: 38 Message-ID: NNTP-Posting-Host: slip-108.tau.ac.il X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #4] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com HELP!!! I can't seem to read a .bmp file correctly under DOS DJGPP(2.01). One of my problems is that there are just too much ways to read a file! But, let's start from the top: I open the file like this: FILE f*=fopen("foo.bmp","rb"); Is "rb" correct? Is that how binary files are opened for reading? Now, I want to read some words, BUT NOT STORE THEM, just check for a valid value and move on: if (getw(f)!=0) return(1); Not only that the correct value is not read, but getw seem to actually read 4 bytes! and it also moves the file pointer in ftell by 4 instead of 2! Is that even possible? getc, by the way, moves the file pointer by 1, not by 2, and it reads the correct value each and every time. When I want to retrieve some values, and store them, I should use fscanf, right? My question is: how can I read a DWord? What is the correct masking letter? And another thing: how are the bytes arranged in the DWord? I mean: if a DWord contains the value 128, in which of those four bytes, will the value 128 be stored? ______ | | | | | ~~~~~~~~~~ Please, hurry, I'm going berserk here! Thank you for your time, Tal Lavi ranla AT post DOT tau DOT ac DOT il P.S. I just can't believe no one knows the answers to my questions in "misc questions"!!!