프로그래밍
CString <-> char* 변환
세상을 꿈꾸다
2011. 7. 7. 19:01
CString str = _T("test");
char* sz;
USES_CONVERSION;
sz = OLE2A(str);
char strbuf[1024];
CString test = _T("testdkeid");
strcpy_s( strbuf, CT2A(test) );
fprintf( fp, "%s \n", strbuf );
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.ko/dv_vclib/html/8f53659e-0464-4424-97db-6b8453c49863.htm
A : ANSI
W : UNICODE
T : Generic charator string
OLE : OLE string
char* sz;
USES_CONVERSION;
sz = OLE2A(str);
char strbuf[1024];
CString test = _T("testdkeid");
strcpy_s( strbuf, CT2A(test) );
fprintf( fp, "%s \n", strbuf );
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.ko/dv_vclib/html/8f53659e-0464-4424-97db-6b8453c49863.htm
A2BSTR | OLE2A | T2A | W2A |
A2COLE | OLE2BSTR | T2BSTR | W2BSTR |
A2CT | OLE2CA | T2CA | W2CA |
A2CW | OLE2CT | T2COLE | W2COLE |
A2T | OLE2T | T2OLE | W2OLE |
A2W | OLE2W | T2W | W2T |
A : ANSI
W : UNICODE
T : Generic charator string
OLE : OLE string