| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Fread problem |
->KC>When i do multiple fread in a file, the position of the file
isn't updated.
->It is in all the compilers I've used.
->KC>Why? What should i do to correct this? Thanks in advance.
->If you show us the code that is giving the problem including the file
->open, preferably in a compileable excerpt, then we can tell you.
->One obvious thought is:- have you opened the file in "append" mode? If
->so the file pointer is updated by the reads, but all writes go to the
->end of the file (as specified by the open mode) and it appears at first
->inspection as a compiler bug when in fact it's a programmer error.
The file I want to open is a BitMaP file and I open it in "rb" (read
binary) mode. I call a fread for the file header structure and for the
info header structure. after this, I call multiple fread for the
palette. There was the bug. This is the source code of where the bug is:
for(i=0;i<256;i++)
fread(palette[i],sizeof(RGBQUAD),1,in);
// palette is an array of RGBQUAD
////
--- Platinum Xpress/Win/Wildcat5! v2.0
* Origin: [F] -=Lions BBS=- Lemoyne, Qc (514)923-7925 (1:167/580)SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728 SEEN-BY: 639/252 670/213 218 @PATH: 167/580 500 166 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.