This character in this file...I can't figure out what it is

Started by
15 comments, last by Russell 22 years, 2 months ago
quote:
a hex editor is a viewer/editor which has binary and hex on it.


I know what a hex editor is, thankyou. And FYI most of them dont show the binary. I havent seen what that does, anyway. And any one worth its salt shows the ASCII too.


I wasnt saying your method didnt work, it just seemed a bit dirty/longwinded for what he wanted.
--------------------Go Stick Your Head In A Pig
Advertisement
On a side note, the reason you original program did not work was that when you open a file with streams, it defaults to ASCII mode of reading. When it does this, whitespace characters act as delimeters and are not read by the stream. Spaces, tabs, newlines and carriage returns are some examples of whitespace. To get your original program to work, you need to open the file as binary.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
If i remember correctly the square box is the null character, you can reproduce it in a dos command line by pressing alt-255
I hope that helps, but it also signifies a carriage return in windows, so thats what most text editors read it as.
The square box is any character not part of the standard Windows character set. Windows only shows maybe 130 characters, and there are 256 possible ascii codes.

~CGameProgrammer( );

~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
quote:Original post by Spiral

a hex editor is a viewer/editor which has binary and hex on it.


I know what a hex editor is, thankyou. And FYI most of them dont show the binary. I havent seen what that does, anyway. And any one worth its salt shows the ASCII too.


I wasnt saying your method didnt work, it just seemed a bit dirty/longwinded for what he wanted.


Hex editors are the long winded version. A hex editor should have the hex displayed and the binary loaded ascii set on the right. Many of the hex editors available only display ascii display characters, not their control characters.


Again, why the hell would a sane man waste time with a hex editor when all he has to do is use edit. - sorry about non-political correctness here.


Beer - the love catalyst
good ol' homepage

Edited by - Dredge-Master on February 6, 2002 8:58:41 PM
Beer - the love catalystgood ol' homepage
quote:Original post by CaptainJester
On a side note, the reason you original program did not work was that when you open a file with streams, it defaults to ASCII mode of reading. When it does this, whitespace characters act as delimeters and are not read by the stream. Spaces, tabs, newlines and carriage returns are some examples of whitespace. To get your original program to work, you need to open the file as binary.

That''s the second piece of incorrect advice you''ve posted today. Sorry to be picky, but when you give people the wrong answers, they just end up posting again a week later wondering why what you said doesn''t work.

All the binary flag does in iostreams is suppress conversion of special characters (eg. converting the new line and carriage return characters to match the OS standard), not change the formatted input and output (eg. << and >>) to stop skipping whitespace. There are special functions (get and getline, I believe) that will read in from a stream without skipping whitespace.



[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]
quote:Original post by Kylotan
All the binary flag does in iostreams is suppress conversion of special characters (eg. converting the new line and carriage return characters to match the OS standard), not change the formatted input and output (eg. << and >>) to stop skipping whitespace. There are special functions (get and getline, I believe) that will read in from a stream without skipping whitespace.

The article I read on this made it sound like you didn''t have to use getline in binary mode. Unfortunately, I can''t find my C++ book and have to rely on information I can find on the Internet to learn what I don''t know.

quote:Original post by Kylotan
That''s the second piece of incorrect advice you''ve posted today. Sorry to be picky, but when you give people the wrong answers, they just end up posting again a week later wondering why what you said doesn''t work.

I would prefer to be corrected, than have the wrong information going around. Thanks and sorry for the wrong advice.

---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement