336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


MFC에서 주로 자용하는 CString 의경우

문자열을 분리할때 타입 문제로 strtok()를 사용하기 복잡해지는데

이역시도 간단한 대처 방법이 있으니...

BOOL AFXAPI AfxExtractSubString (
   CString& rString,
   LPCTSTR lpszFullString,
   int iSubString,
   TCHAR chSep = '\n'
);

rString
  • Reference to a CString object that will receive an individual substring.

lpszFullString
  • String containing the full text of the string to extract from.

iSubString
  • Zero-based index of the substring to extract from lpszFullString.

chSep
  • Separator character used to delimit substrings.


바로 요녀석 되겠다

간단한 예를 들어보면
CString strData = "write test.txt 0x00000000 1024";
CString strCmd, strFilename, strAddress, strLength;
AfxExtractSubString(strCmd, strData, 0, ' ');         // => write
AfxExtractSubString(strFilename, strData, 1, ' ');   // => test.txt
AfxExtractSubString(strAddress, strData, 2, ' ');    // => 0x00000000
AfxExtractSubString(strLength, strData, 3, ' ');      // => 1024

참 쉽죠~잉!

+ Recent posts