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 #33448 is a reply to message #33447] Mon, 08 August 2011 13:24 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
	for (i=0; i<fl; i++)
	{
		
		
	    thebyte = mfileinfo[i];	    


The problem is in above line. The issue is that String is a collection of 'char' elements, which are signed entities. Therefore, it returns negative value for 0xc3.

There is little that can be done about it, as long as we want to be compatible with

char h[1] = { 0xc3 }

h[0] in any expression would yield a negative value as well.

So this problem is deeply buried in C++ resolution to use signed value for char.

However, fix is trivial:

	for (i=0; i<fl; i++)
	{
	    thebyte = (byte)mfileinfo[i];	    


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: Fri May 17 19:25:21 CEST 2024

Total time taken to generate the page: 0.03992 seconds