char to unicode string and back
Hello,
I'm trying to translate my DOS data to unicode but in understanding C++ strings I am not too far :) so I need help. I get message "string is not declared" so I think that here misses some header too.
I started as shown but any suggestion will be appreciated. Speed is first criteria.
Scenario:
I read chars as binary (from file) then loop through them to replace certain characters with unicode ones. After every character I compose new stringTO with new values. At the end I should got unicode string stringTO in memory.
Of course, my example dont work :( (but it is close :)
Code:
string stringTO = ' ';
int o;
for(o=0;myInputString[o] !='\0';o++)
{
int a=myInputString[o];
charTO=a
if (a==172){charTO = 'Č';}
if (a==143){charTO = 'Ć';}
if (a==230){charTO = 'Š';}
if (a==209){charTO = 'Đ';}
if (a==166){charTO = 'Ž';}
if (a==159){charTO = 'č';}
if (a==134){charTO = 'ć';}
if (a==231){charTO = 'š';}
if (a==208){charTO = 'đ';}
if (a==167){charTO = 'ž';}
stringTO = stringTO + charTO
}
fprintf (fo, "%s\n", stringTO);
}
Can this go at shown way?