Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to add animation CWaitCursor Pin
ptr_Electron25-May-09 1:39
ptr_Electron25-May-09 1:39 
AnswerRe: how to add animation CWaitCursor Pin
Cedric Moonen25-May-09 1:41
Cedric Moonen25-May-09 1:41 
GeneralRe: how to add animation CWaitCursor Pin
ptr_Electron25-May-09 1:47
ptr_Electron25-May-09 1:47 
GeneralRe: how to add animation CWaitCursor Pin
Nibu babu thomas25-May-09 2:05
Nibu babu thomas25-May-09 2:05 
QuestionRe: how to add animation CWaitCursor Pin
David Crow25-May-09 8:42
David Crow25-May-09 8:42 
AnswerRe: how to add animation CWaitCursor [modified] Pin
ptr_Electron25-May-09 21:02
ptr_Electron25-May-09 21:02 
QuestionRe: how to add animation CWaitCursor Pin
David Crow26-May-09 3:03
David Crow26-May-09 3:03 
QuestionWriteProfileString() Pin
susanne125-May-09 1:27
susanne125-May-09 1:27 
AnswerRe: WriteProfileString() Pin
Garth J Lancaster25-May-09 2:06
professionalGarth J Lancaster25-May-09 2:06 
Questionsaving file Pin
trioum24-May-09 23:54
trioum24-May-09 23:54 
AnswerRe: saving file Pin
CPallini25-May-09 0:08
mveCPallini25-May-09 0:08 
GeneralRe: saving file (thread hijack) Pin
Garth J Lancaster25-May-09 0:16
professionalGarth J Lancaster25-May-09 0:16 
GeneralRe: saving file (thread hijack) Pin
CPallini25-May-09 0:24
mveCPallini25-May-09 0:24 
GeneralRe: saving file Pin
trioum25-May-09 0:24
trioum25-May-09 0:24 
GeneralRe: saving file Pin
Rajesh R Subramanian25-May-09 0:39
professionalRajesh R Subramanian25-May-09 0:39 
GeneralRe: saving file Pin
trioum25-May-09 0:50
trioum25-May-09 0:50 
GeneralRe: saving file Pin
Rajesh R Subramanian25-May-09 1:02
professionalRajesh R Subramanian25-May-09 1:02 
GeneralRe: saving file Pin
trioum25-May-09 1:07
trioum25-May-09 1:07 
GeneralRe: saving file Pin
Rajesh R Subramanian25-May-09 1:23
professionalRajesh R Subramanian25-May-09 1:23 
AnswerRe: saving file Pin
Garth J Lancaster25-May-09 0:10
professionalGarth J Lancaster25-May-09 0:10 
AnswerRe: saving file Pin
Hamid_RT25-May-09 0:59
Hamid_RT25-May-09 0:59 
GeneralRe: saving file [modified] Pin
trioum25-May-09 1:02
trioum25-May-09 1:02 
GeneralRe: saving file Pin
killabyte25-May-09 20:34
killabyte25-May-09 20:34 
QuestionRe: saving file Pin
Maximilien25-May-09 4:56
Maximilien25-May-09 4:56 
QuestionANSI to UTF-8 Pin
Souldrift24-May-09 23:15
Souldrift24-May-09 23:15 
Hi there,

I found a code snippet on the web which converts an ANSI string to UTF-8 format. I implemented it in my own and it works.

<br />
////////////<br />
// to UTF-8<br />
char text[1024]={0};<br />
WCHAR w[1024]={0};<br />
int erg=0;<br />
<br />
strcpy(text, m_pData);<br />
<br />
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, sizeof(w) / sizeof(WCHAR)); // ANSI to UNICODE<br />
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, sizeof(text), 0, 0);	    // UNICODE to UTF-8<br />
//<br />
////////////<br />


After that 'text' is UTF-8 formatted just nicely.

Now I was wondering, why doesn´t the following (slightly altered) code not work? I just created a char* instead of char[];

<br />
////////////<br />
// to UTF-8<br />
char* text = new char[1024];<br />
WCHAR w[1024]={0};<br />
int erg=0;<br />
<br />
strcpy(text, m_pData);<br />
<br />
erg=MultiByteToWideChar(CP_ACP, 0, text, -1, w, sizeof(w) / sizeof(WCHAR)); // ANSI to UNICODE<br />
erg=WideCharToMultiByte(CP_UTF8, 0, w, -1, text, sizeof(text), 0, 0);	    // UNICODE to UTF-8<br />
//<br />
////////////<br />


Thanks,

Souldrift

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.