|
|
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » MSC8 compile error "Button Example"
|
|
Re: MSC8 compile error "Button Example" [message #4003 is a reply to message #3989] |
Fri, 14 July 2006 14:44 |
yoco
Messages: 25 Registered: June 2006 Location: Taiwan
|
Promising Member |
|
|
I solved this problem.
The problem caused by the default charset in Taiwan is Big-5 (similar with iso-8895-1).
In far-east country, their words are more than 255,
far more than a byte can represent,
so sometimes they hava to combine two bytes to represent one words.
In this charset,
If the ASCII of a char is smaller than 127, it will treate as a normal ANSI char.
If the ASCII of a char is bigger than 128, it will be combined with the next char to represent one far-east word.
A segment of the Ctrl.iml file
In standerd ANSI, it looks like this
IMAGE_SCAN("Õ\1\0¤¤‚\0\377\377\2ÀÀÀ\0\0\0Ö")
IMAGE_SCAN("Ô\1\0¤¤„\0\377\377\3ÀÀÀ\0\0\0¤¤¤Ô")
IMAGE_SCAN("Ô\1\0¤¤…\0\377\377\1\0\0\0‚¤¤¤Ó")
IMAGE_SCAN("Ó\1\0¤¤†\0\377\377\2ÀÀÀ\0\0\0‚¤¤¤Ò")
but in Big-5 charset, it is...
IMAGE_SCAN("惝1\0¤¤倦0\377\377\2擬餐0\0\0?)
IMAGE_SCAN("偅1\0¤¤浅0\377\377\3擬餐0\0\0¤¤¤?)
IMAGE_SCAN("偅1\0¤¤诉0\377\377\1\0\0\0?¤¤?)
IMAGE_SCAN("罡1\0¤¤赅0\377\377\2擬餐0\0\0?¤¤?)
The second qoute which to close the string literal,
was been combined with the previous byte to present one fareast word,
cause of the prevouis byte is bigger than 128.
Since there are no qoute to close the string literal,
so it raised a C2001 compile error in MS VC++.
I had wrote a simple program to translate the original .iml file to a new one,
by replace byte bigger than 128 to OCT string literal form.
Recompile, and everything is fine.
I hope this may be helpful to you.
PS. the simple program.
int main( int args, char* argv[] )
{
string fn = argv[1] ;
ifstream fin ( fn.c_str() ,ios_base::binary ) ;
if ( !fin ) { cout << fn << " not exist!" << endl ; return 0 ;}
string cmd( "copy" ) ;
cmd = cmd + " " + fn + " " + fn + ".bak" ;
system ( cmd.c_str() ) ;
fin.close() ;
fin.open( (fn+".bak").c_str() ) ;
ofstream fout(fn.c_str()) ;
char buf [5] = "\\" ;
unsigned char ch ;
while ( fin.get((char&)ch) ) {
if ( ch<128 ) { fout.put(ch) ; }
else {
buf[1] = '0' + ch/64 ;
buf[2] = '0' + (ch%64)/8 ;
buf[3] = '0' + ch%8 ;
fout << buf ;
}
}
}
|
|
|
|
Goto Forum:
Current Time: Thu Apr 25 09:37:10 CEST 2024
Total time taken to generate the page: 0.03825 seconds
|
|
|