|Forum Index | FAQ | New User | Login | Search|
|Posted by||Snowball 2|
|Posted on||07/08/04 09:01 PM|
I'm reading in 2 separate formats of text for the input file. If it's ANSI text there's a character at every byte and seekg restores me to where I should be. If it's UCS-2 I read in a word and the character is either at the lower order or higher order byte(higher in this specific case). When I restore my pointer it will point to the byte that is between the characters in UCS-2 which contains only the value 0. At least that's the way it happens when I try to read it afterwards.
After that it breaks my program as it's pulling input that once looked like CHARACTER-ZERO that's now ZERO-CHARACTER and I can't tell if I skipped the previous character by accident or that I'm reading half of the next.
I need to understand where exactly the pointer is dropping me off. I'm using raw read and write functions of ifstream because using the character grabbing functions won't be as reliable especially with UCS-2 encoding(and other formats may be included as well so just widening the characters won't be enough).
Anyone want to shed some light on this? I can include more code and sample input later if necessary.