Click here to Skip to main content
15,919,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can somebody explain these lines for me? Pin
adamUK25-Sep-02 21:45
adamUK25-Sep-02 21:45 
GeneralRe: Can somebody explain these lines for me? Pin
Mazdak25-Sep-02 22:21
Mazdak25-Sep-02 22:21 
AnswerRe: Can somebody explain these lines for me? Pin
Steve S25-Sep-02 21:46
Steve S25-Sep-02 21:46 
GeneralRe: Can somebody explain these lines for me? Pin
Mazdak25-Sep-02 22:20
Mazdak25-Sep-02 22:20 
Generallistbox question Pin
Mazdak25-Sep-02 20:59
Mazdak25-Sep-02 20:59 
GeneralRe: listbox question Pin
Roman Fadeyev25-Sep-02 23:35
Roman Fadeyev25-Sep-02 23:35 
GeneralRe: listbox question Pin
Mazdak25-Sep-02 23:50
Mazdak25-Sep-02 23:50 
GeneralCString Unicode Problem! Pin
Daniel Strigl25-Sep-02 20:49
Daniel Strigl25-Sep-02 20:49 
I have written some code to save a CString to a file with the WriteFile API function (I prever to use the API function and not the CFile member functions).

CString str = _T("HI");

if (!WriteFile(hFile, str, str.GetLength(), &dwWrittenBytes, NULL) || 
        dwWrittenBytes != (DWORD) str.GetLength())
{
    AfxMessageBox(_T("Could not write to file."), MB_OK | MB_ICONEXCLAMATION);   
    return FALSE;
}


On Windows XP (or other Windows Systems) it works fine, but when I use the code in Embedded Visual C++ 3.0 in the Emulator I have to change the code like the following, to get the same result as under WinXP.

CString str = _T("HI");

if (!WriteFile(hFile, str, str.GetLength() * 2, &dwWrittenBytes, NULL) || 
        dwWrittenBytes != (DWORD) str.GetLength() * 2)
{
    AfxMessageBox(_T("Could not write to file."), MB_OK | MB_ICONEXCLAMATION);   
    return FALSE;
}


I have to write twice as much characters (str.GetLength() * 2) to get the same result! Is that something with Unicode? Can anyone explane me that? And, how I have to write this function that it works under both systems (XP and CE)?

(When I debug the code in Embedded VC++ 3.0 and I look the memory where the string in CString is saved, every second character is 0, like 'H|I|' --> | is for 0.)

--
Nice greets, Daniel.
GeneralRe: CString Unicode Problem! Pin
567890123425-Sep-02 20:54
567890123425-Sep-02 20:54 
GeneralRe: CString Unicode Problem! Pin
Daniel Strigl25-Sep-02 21:08
Daniel Strigl25-Sep-02 21:08 
GeneralRecent File List help Pin
Chou25-Sep-02 19:18
Chou25-Sep-02 19:18 
GeneralRe: Recent File List help Pin
Steve S25-Sep-02 22:04
Steve S25-Sep-02 22:04 
GeneralRe: Recent File List help Pin
Chou25-Sep-02 22:43
Chou25-Sep-02 22:43 
GeneralRe: Recent File List help Pin
Steve S25-Sep-02 23:00
Steve S25-Sep-02 23:00 
GeneralRe: Recent File List help Pin
Chou25-Sep-02 23:35
Chou25-Sep-02 23:35 
GeneralRe: Recent File List help Pin
Steve S25-Sep-02 23:37
Steve S25-Sep-02 23:37 
GeneralDialog in a DLL Pin
DarrollWalsh25-Sep-02 18:30
DarrollWalsh25-Sep-02 18:30 
GeneralRe: Dialog in a DLL Pin
RedZenBird25-Sep-02 18:59
RedZenBird25-Sep-02 18:59 
GeneralRe: Dialog in a DLL Pin
DarrollWalsh25-Sep-02 20:10
DarrollWalsh25-Sep-02 20:10 
GeneralFile properties Pin
Bugra Barin25-Sep-02 18:10
Bugra Barin25-Sep-02 18:10 
GeneralRe: File properties Pin
RedZenBird25-Sep-02 19:08
RedZenBird25-Sep-02 19:08 
GeneralRe: File properties Pin
Bugra Barin25-Sep-02 20:37
Bugra Barin25-Sep-02 20:37 
GeneralRe: File properties Pin
Steve S25-Sep-02 22:01
Steve S25-Sep-02 22:01 
GeneralRe: File properties Pin
Jawache25-Sep-02 23:08
Jawache25-Sep-02 23:08 
QuestionWhere Can I get C/C++ API docs? Pin
shi25-Sep-02 17:49
shi25-Sep-02 17:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.