| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Fread problem |
Hi Karl, You wrote to me: KC>->KC>When i do multiple fread in a file, the position of KC>->KC>the file isn't updated. KC>->It is in all the compilers I've used. KC>->KC>Why? What should i do to correct this? Thanks in advance. KC>->If you show us the code that is giving the problem including the file KC>->open, preferably in a compileable excerpt, then we can tell you. KC>The file I want to open is a BitMaP file and I open it in "rb" (read KC>binary) mode. I call a fread for the file header structure and for the KC>info header structure. after this, I call multiple fread for the KC>palette. There was the bug. This is the source code of where the bug is: KC>for(i=0;i<256;i++) KC> fread(palette[i],sizeof(RGBQUAD),1,in); KC>// palette is an array of RGBQUAD KC>//// The only likely bug I can see there is palette[i], rather than &palette[i], you pass the _location_ to read the data into (the address of the variable), not the variable itself. It would be much simpler (and quicker) to do: fread (palette,sizeof(palette[0]),256,in); As you didn't give the surrounding code and a compileable excert I can't do any more, I really need to see more than you have given to give proper help. What I am certain of though is that you are mis-interpreting the side effects of a bug in your code as being a problem with fread(). George * SLMR 2.1a * Computers eliminate spare time. --- Maximus/2 3.01* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4) 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: 440/4 255/1 252/356 140/1 270/101 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™.