C / C++ / MFC

CString to char * , char * to CString

★조군™ 2012. 4. 6. 19:09

 

1. CString to char *

CString strTemp;

char buffer[MAX_PATH];

strcpy(buffer, (LPSTR)(LPCSTR)strTemp);

 

2. char * to CString

CString strTemp;

char buffer[MAX_PATH];

strTemp=(LPSTR)buffer;

// (LPSTR)은 char *을 CString 형태로 변환.

 

출처 : http://blog.naver.com/rayofuth?Redirect=Log&logNo=14207270