i wanna read from my ss0 file (in hex :-) 1 char at a time)Code:ifstream nessave("C:/ff1/ff1.ss0", ios:in);
i wanna read from my ss0 file (in hex :-) 1 char at a time)Code:ifstream nessave("C:/ff1/ff1.ss0", ios:in);
Try
Code:nessave.setf(ios::hex); while (!nessave.eof()) nessave.get(mychar);
ios::hex i believe is the correct parameter....as far as one character at a time, that may be difficult since hex is like this: E0A4B3
so you may want to toy with that...especially cause 12345678 is hex too.
PHP and XML
Let's talk about SAX
Yes but surely if i read one char from the file "!" wouldnt it read it as "21" then?
Last edited by krappykoder; 12-19-2002 at 09:12 AM.
Wait, what am I talking about
Open the file as ifstream nessave("C:/ff1/ff1.ss0", ios::in | ios::binary); and simply read a char in using nessave.get(). Loop until eof is read.
There, done. Your char can represent from 0 to 0xFF.
If you read in '!', you can either work with it as 0x21, or 33.
You make it sound so easy. how do i use get() and should it be a char or int?
But when i output what ive read it always prints " î ".Code:ff1.ss0 A B C D E F
Its simple. Open the file in binary mode. Then use ifstream::get() to read a char. Do something like this before you print it:
cout.setf(ios::hex | ios::showbase | ios::uppercase);
cout << static_cast<int>(my_char_that_i_read);
It's all in how you work with it.