Click here to Skip to main content
15,893,381 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralComputer freezing up on wait Pin
theFrenchHornet12-Apr-05 12:08
theFrenchHornet12-Apr-05 12:08 
GeneralRe: Computer freezing up on wait Pin
Jack Puppy12-Apr-05 13:06
Jack Puppy12-Apr-05 13:06 
GeneralRe: Computer freezing up on wait Pin
theFrenchHornet13-Apr-05 5:01
theFrenchHornet13-Apr-05 5:01 
GeneralRe: Computer freezing up on wait Pin
theFrenchHornet14-Apr-05 6:35
theFrenchHornet14-Apr-05 6:35 
GeneralRe: Computer freezing up on wait Pin
Blake Miller14-Apr-05 9:29
Blake Miller14-Apr-05 9:29 
GeneralRe: Computer freezing up on wait Pin
Blake Miller13-Apr-05 6:52
Blake Miller13-Apr-05 6:52 
GeneralRe: Computer freezing up on wait Pin
theFrenchHornet14-Apr-05 6:33
theFrenchHornet14-Apr-05 6:33 
GeneralReading A File Pin
LighthouseJ12-Apr-05 11:33
LighthouseJ12-Apr-05 11:33 
I don't see how this got to be a problem, but I'm trying to read a bitmap file data in a raw fashion, byte by byte. I'm dealing with 8-bit images and therefore my data starts at 0x436 (1078 bytes from the beginning of the file). I'm trying to read the file in 64-byte chunks using file pointers. I've used fseek to position the data read pointer at the start of the data properly and it starts to read fine. When it gets to byte 62, that's when the problems begin. I have a variable that's set by ftell to tell me the file position which I interpret it to be the byte offset from the start of the file. Before the problem, the characters are fine and the file position is where it should be. Once it hits byte 62, the characters it gets are different from what it should be and the file position reads 5175 instead of 1141 for byte 63.

Here's 96 bytes of what I'm trying to read from:
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1D 1D 1C 1C 1B 1D 1C 1B 1B 1A 1D
1D 1B 1B 1B 1B 1B 1C 1D 1B 1C 1C 1D 1D 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E


Here's the result, I've bolded the bytes that are different:
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1D 1D 1C 1C 1B 1D 1C 1B 1B 1E 1E
1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E 1E


The 1E's at the end of the snip are probably 1E's from somewhere else, the picture I'm reading is of a very white moon on a very black background. Any help would be greatly appreciated because this is an annoying problem.

edit: I was using fgetc to get a char (cast into a BYTE), but I tried using fscanf but the behavior is still the same, quite strange.
GeneralFollow-Up Pin
LighthouseJ12-Apr-05 16:03
LighthouseJ12-Apr-05 16:03 
GeneralRe: Follow-Up Pin
John R. Shaw12-Apr-05 19:16
John R. Shaw12-Apr-05 19:16 
GeneralRe: Follow-Up Pin
LighthouseJ12-Apr-05 19:30
LighthouseJ12-Apr-05 19:30 
GeneralRe: Follow-Up Pin
John R. Shaw12-Apr-05 20:43
John R. Shaw12-Apr-05 20:43 
GeneralRe: Follow-Up Pin
LighthouseJ13-Apr-05 4:02
LighthouseJ13-Apr-05 4:02 
GeneralRe: Reading A File Pin
Ryan Binns12-Apr-05 18:25
Ryan Binns12-Apr-05 18:25 
GeneralRe: Reading A File Pin
LighthouseJ12-Apr-05 19:16
LighthouseJ12-Apr-05 19:16 
GeneralRe: Reading A File Pin
namaskaaram12-Apr-05 21:20
namaskaaram12-Apr-05 21:20 
GeneralRe: Reading A File Pin
LighthouseJ13-Apr-05 4:01
LighthouseJ13-Apr-05 4:01 
GeneralRe: Reading A File Pin
Blake Miller13-Apr-05 7:12
Blake Miller13-Apr-05 7:12 
GeneralRe: Reading A File Pin
namaskaaram13-Apr-05 19:36
namaskaaram13-Apr-05 19:36 
Generalserial port comm at low baud rate (50/75 /100 baud) in windows Pin
pcm21112-Apr-05 8:40
pcm21112-Apr-05 8:40 
GeneralCToolBar and CToolBatCtrl Pin
odiesback12-Apr-05 8:40
odiesback12-Apr-05 8:40 
GeneralRe: CToolBar and CToolBatCtrl Pin
Jack Puppy12-Apr-05 12:50
Jack Puppy12-Apr-05 12:50 
GeneralRe: CToolBar and CToolBatCtrl Pin
odiesback13-Apr-05 4:33
odiesback13-Apr-05 4:33 
GeneralAdding a file to Windows MRU Pin
yarp12-Apr-05 8:36
yarp12-Apr-05 8:36 
GeneralRe: Adding a file to Windows MRU Pin
Gary Kirkham12-Apr-05 8:38
Gary Kirkham12-Apr-05 8:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.