Click here to Skip to main content
14,768,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have a MFC/C++ Unicode project and we want to replace some older CString splitting routines by swscanf like

CString strTest = _T("Test1 - Test2");
CString strResult1, strResult2;

swscanf(strTest, _T("%ls - %ls"), strResult1, strResult2);

but the result is

strResult1 = strResult2 = "Test2".

I am desperate... What's going wrong?

1 solution

CString has a getbuffer method, or something similar, to get the buffer for methods like this.
sja63 20-Dec-12 4:24am
Right! It works. Thank You.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900