Skip to main content
gamedev.net
🔒 Locked

Reading binary data...

Started by Tree Penguin Apr 27, 2004 at 11:25 AM 6 replies 450+ views
Original Post
Tree Penguin
Tree Penguin
Hi, i am reading a .raw image file and it seems there is at least one character that isn''t read when using (ifstream file variable)>>(an unsigned char), which one(s) is/are it and why is/are it/they invalid? Thanks in advance! WWW.TREEPENGUIN.TK
OpenGL_Guru
OpenGL_Guru
hey you! how are ya i wish i could help ya, when i get home tonight if you are on i might be able to help ya i dunno.. but i do hope you get the problem fixed...sometimes binary files can be hidden or end up being weird characters that windows(assuming you are in windows) cannot understand so it skips the character altogether or it will subsitutue it i have found for some other weird "pac-man" or Q-bert character. anyway talk to you later tonight maybe bye...
heh
SiCrane
SiCrane
Did you open the file with the binary mode flag set?
Fruny
Fruny
*cries*
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Thunder_Hawk
Thunder_Hawk
You shouldn''t use the extraction operator on a binary file. Use the read method instead.

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma
Tree Penguin
Tree Penguin
quote:
Original post by Fruny
*cries*


Why, am i doing something terribly wrong ? If so just tell it the next time. Anyway, this is something i learned a long time ago and it''s straight out of a book, so it isn''t totally wrong or something, no reason to cry.

Anyway i''ll try the read function.

WWW.TREEPENGUIN.TK
Fruny
Fruny
I''m just crying because I''m trying to solve the problem of "binary stream IO" questions on gamedev.net once and for all. You''re just the fourth (I believe) person to have problems with it in the past two days or so. Nothing wrong with you personally, and I know I should feel encouraged, but still, it''s sometime depressing to see that it keeps popping up.


“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.