Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » BUG? or Not BUG? LoadFile(filename) and then getting wrong data
Re: BUG? or Not BUG? LoadFile(filename) and then getting wrong data [message #33442 is a reply to message #33441] Sun, 07 August 2011 12:59 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
silverx wrote on Sat, 06 August 2011 04:58

I am try to write a hex viewer, and I am using the following to get the data in from the file.

String mfileinfo = LoadFile(fs);

Then I am using

thebyte = mfileinfo[i];

Where i just counts through 1 byte at a time the data on the file.

I have tried with thebyte being defined as int unsigned, int, and char, and when it encounters a hex byte of C3 in the input file it gives the value as -61, also when it comes to a C8 it gives a -56 as the value for thebyte.

When C3 should return 195, and the C8 should return 200.

Why am I getting the what I think is the wrong value for those bytes? How do I get it to return the correct value?

Is this a BUG, problem with LoadFile? Should I use some other way to load the data into the program?

Thanks

David


Well, I know pretty sure LoadFile works. Means it is something else, but hard to say on so little info.

Anyway, (char)-61 is 0xc3, so the most likely reason is that you put data into 'char'....

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Polymorphic Array doubt
Next Topic: Need help about the codepage!
Goto Forum:
  


Current Time: Wed May 15 01:42:28 CEST 2024

Total time taken to generate the page: 0.01645 seconds