M
Mr. K.V.B.L.
I'm scouring the net trying to find this answer but coming up empty.
Everything I've tried is not compiling. I'm trying to define a
iomanipulator that will convert some text to another character set
then output. So, something like:
cout << ascii(ebcdicTextString) << endl;
Is it not standard from one platform to another? In this case the
compiler is saying that 'ascii' is unexpected. I'm including
<iostream> and <iomanip>. Thanks a bunch!
ostream& convert2ascii(ostream &out, string str)
{
string asciiResponse;
char *target = new char[str.length() + 1];
UErrorCode status = U_ZERO_ERROR;
int32_t i = ucnv_convert("iso-8859-1", "ibm-37", target, str.length
() + 1, str.c_str(), str.length(), &status);
asciiResponse = target;
delete[] target;
return out << asciiResponse;
}
OMANIP(string) ascii(string str)
{
return OMANIP(string) (convert2ascii,str);
}
Everything I've tried is not compiling. I'm trying to define a
iomanipulator that will convert some text to another character set
then output. So, something like:
cout << ascii(ebcdicTextString) << endl;
Is it not standard from one platform to another? In this case the
compiler is saying that 'ascii' is unexpected. I'm including
<iostream> and <iomanip>. Thanks a bunch!
ostream& convert2ascii(ostream &out, string str)
{
string asciiResponse;
char *target = new char[str.length() + 1];
UErrorCode status = U_ZERO_ERROR;
int32_t i = ucnv_convert("iso-8859-1", "ibm-37", target, str.length
() + 1, str.c_str(), str.length(), &status);
asciiResponse = target;
delete[] target;
return out << asciiResponse;
}
OMANIP(string) ascii(string str)
{
return OMANIP(string) (convert2ascii,str);
}