본문 바로가기
My/works

[MFC] Cstring <-> Char* 형변환

by matt131 2012. 12. 26.
반응형


CString Char* 형 변환 하는법
 

CString -> Char *

 

CString strBuffer;
char szBuffer[MAX_PATH] = {0,};
int nLength = (MAX_PATH > strlen(strBuffer)) ? strlen(strBuffer) : MAX_PATH;
strncpy(szBuffer, (LPSTR)(LPCSTR)strBuffer, nLength);


 

Char * -> CString

CString strBuffer;
char szBuffer[MAX_PATH];
strBuffer = (LPSTR)szBuffer;

 

반응형