CString to char *

//CString -> char *
CString str;
str = "Hello";
char* pch = LPSTR(LPCTSTR(str));
//char * --> CString
char pch[] = "Hello";
CString str;
str.Format("%s", pch);

오늘 알아낸 내용.

CString filename;
char * filen;
CT2CA filen(filename); >> 실패

-  CString => const char*
CString FileName = _T("file.txt");
const char* Name;
Name = (CStringA)FileName;

- const char* -> CString 
const char* Name = "test";
CString FileName;
FileName = (CString)Name;

CStringT type : Declaration
CStringA        : An ANSI charcter type string with CRT support.
CStringW       : A Unicode charater type string with CRT support.
CString          : Both ANSI and Unicode charcter types with CRT support

Comments

Popular posts from this blog

[VS2010][VS2015] "stdafx.h 을 포함 소스를 찾을 수 없습니다" 에러 해결법