几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】string Conversion Using Code Page (http://www.dimcax.com/hust/showthread.php?t=18680)

yang686526 2009-05-07 04:28 PM

【转帖】string Conversion Using Code Page
 
string conversion using code page
string conversion using code page
in the hope of converting a string in a windows dwg file from codepage ansi_1252 (the one in the dwg file) into a macintosh compatible string i do this:
void importer:xfread_convertstringwindowtomac(char * psz)
{
unsigned char * p;
wchar_t newchar, thecar;
odresult res;
p= (unsigned char *)psz;
while(*p!=0)
{
thecar= (wchar_t) *p;
res= odcharmapper::codepagetounicode(thecar,(odcodepage id) pdb->getdwgcodepage(), newchar);
res= odcharmapper::unicodetocodepage(newchar, cp_macintosh, thecar);
*p++= newchar;
}
}
the first res is always eok, but the second is always ecodepagenotfound
and no conversion occurs. odcharmapper has been correctly initialized using adinit.dat.
should the above code work or am i doing something wrong ?
thanks for any help..


所有的时间均为北京时间。 现在的时间是 11:30 PM.