본문 바로가기
반응형

TCHAR3

[개발/vc++] 유니코드로 저장하기, UTF8로 저장하기 [개발/vc++] 유니코드로 저장하기 // 첫 식별자가 파일의 처음 부분이 "FFFE" 값이다. 그리고 두바이트씩 문자크기를 갖는다. TCHAR szPath[] = _T("12345"); int nlen = _tcslen(szPath); CFile file (_T("D:\\test.xml"), CFile::modeCreate|CFile::modeWrite); TCHAR szTmp[2]; WORD wd = 0xfeff; memcpy(szTmp, &wd, 2); file.Write(szTmp, 2); file.Write(szPath, nlen * sizeof(TCHAR)); file.Close(); [개발/VC++] UTF-8로 저장하기 // 헤더가 3바이트이다. 문자는 3바이트씩 저장 // utf-8로 저.. 2012. 1. 19.
[개발/MFC] 스트링 형변환 [개발/MFC] 스트링 형변환 문자관련 함수 MBCS(multi-byte character set) : ASCII 코드 문자열을 쓰는 함수 WCS(wide character string) : 유니코드 문자열을 쓰는 함수 함수 제일 뒤에 ASCII를 나타내는 A와 Wide Character를 나타내는 W를 붙여서 구분함. 예) GetCurrentDirectoryA ... 예외) cout, wcout LPCTSTR(Long Pointer Constant TCHAR String) 여기서 TCHAR 라는 것은 typedef 유니코드가 설정되어 있으면 2바이트로(wchar_t) 아니면 기존 char 방식인 1바이트로(char) 한다는 것을 의미. LPSTR : 8비트 윈도우 캐릭터 스트링(string) 포인터 문.. 2012. 1. 7.
[VC++/MFC] CString to char * 와 char * to CString CString -> char * CString str; str = "Hello"; char* ss = LPSTR(LPCTSTR(str)); char * --> CString char ss[] = "Hello"; CString str; str.Format("%s", ss); (Format대신에 GetBuffer()를 써도 됩니다.) 지식인! Environment: Compiled using VC6.0 Sp3 and tested using Win95/98 WinNT4.0 and Win 2000 Here are a few data Conversions with small examples :- PART ONE :- DECIMAL CONVERSIONS Decimal To Hexa :- Use _itoa( ) fu.. 2010. 9. 30.
반응형