Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About pthread scheduling (C programming) Pin
CPallini24-Jan-14 3:24
mveCPallini24-Jan-14 3:24 
GeneralRe: About pthread scheduling (C programming) Pin
Erudite_Eric29-Jan-14 22:56
Erudite_Eric29-Jan-14 22:56 
QuestionCreate Custom Events in Windows OS Pin
AmbiguousName23-Jan-14 20:48
AmbiguousName23-Jan-14 20:48 
QuestionRe: Create Custom Events in Windows OS Pin
Richard MacCutchan23-Jan-14 23:11
mveRichard MacCutchan23-Jan-14 23:11 
AnswerRe: Create Custom Events in Windows OS Pin
AmbiguousName23-Jan-14 23:19
AmbiguousName23-Jan-14 23:19 
GeneralRe: Create Custom Events in Windows OS Pin
Richard MacCutchan23-Jan-14 23:53
mveRichard MacCutchan23-Jan-14 23:53 
QuestionMqrtlarge and large message handling differ between Biztalk versions? Pin
Daniel Jansson22-Jan-14 19:24
Daniel Jansson22-Jan-14 19:24 
QuestionCDHtmlDialog : Not supporting "Canvas" tag in HTML Pin
Don Guy22-Jan-14 12:38
Don Guy22-Jan-14 12:38 
AnswerRe: CDHtmlDialog : Not supporting "Canvas" tag in HTML Pin
Lost Penguin22-Jan-14 16:59
Lost Penguin22-Jan-14 16:59 
AnswerRe: CDHtmlDialog : Not supporting "Canvas" tag in HTML Pin
SoMad22-Jan-14 20:17
professionalSoMad22-Jan-14 20:17 
GeneralRe: CDHtmlDialog : Not supporting "Canvas" tag in HTML Pin
Don Guy23-Jan-14 5:55
Don Guy23-Jan-14 5:55 
QuestionVC++ Snippets Pin
BarryPearlman22-Jan-14 7:16
BarryPearlman22-Jan-14 7:16 
AnswerRe: VC++ Snippets Pin
Richard MacCutchan22-Jan-14 9:18
mveRichard MacCutchan22-Jan-14 9:18 
GeneralRe: VC++ Snippets Pin
BarryPearlman22-Jan-14 10:03
BarryPearlman22-Jan-14 10:03 
GeneralRe: VC++ Snippets Pin
Richard MacCutchan22-Jan-14 20:59
mveRichard MacCutchan22-Jan-14 20:59 
AnswerRe: VC++ Snippets Pin
David Crow23-Jan-14 3:42
David Crow23-Jan-14 3:42 
AnswerRe: VC++ Snippets Pin
BarryPearlman23-Jan-14 4:01
BarryPearlman23-Jan-14 4:01 
QuestionWhat mac is the best for visual C++ Pin
javaandcpp1022-Jan-14 5:31
javaandcpp1022-Jan-14 5:31 
SuggestionRe: What mac is the best for visual C++ Pin
Richard MacCutchan22-Jan-14 5:39
mveRichard MacCutchan22-Jan-14 5:39 
AnswerRe: What mac is the best for visual C++ Pin
Albert Holguin27-Jan-14 7:30
professionalAlbert Holguin27-Jan-14 7:30 
QuestionNeed help to show chm-Files? Pin
bosfan22-Jan-14 4:31
bosfan22-Jan-14 4:31 
QuestionDirect Show : "Mp3 Decoder DMO" filter fails to return any input pins Pin
sdancer7522-Jan-14 0:55
sdancer7522-Jan-14 0:55 
Questionplease help me to convert string in Unicode bytes? Pin
Le@rner21-Jan-14 22:54
Le@rner21-Jan-14 22:54 
hi

hi can u please help me to convert string in Unicode bytes,

I do this like this:
C++
CString Hex(long val)
{	
 
	CString Buf=_T("");
	Buf.Format(_T("%X"),val);
	return Buf;
 
}
int Asc(const CString &cs) 
{	
	unsigned char ch= cs[0];
	return ch;
}
int AscW(const CString &cs) 
{	
	CString g=_T("");
 
	//unsigned char ch= cs[0];
	int ch = cs[0];
 
	g.Format(_T("%d"),ch);
 
	return _ttoi(g);
}
 
CString EncodeUserData_16_bit(CString strUserData)
{
	CString EncodeUserData_16_bit;
	int I=0;
	CString hex_string=_T("");
	
	for( I = 0; I<strUserData.GetLength();I++) 	
	{
		hex_string=_T("");
		CString c=strUserData.Mid(I + 1-1, 1);
		
		int ch=Asc(c);
		
		CString g=_T("");
		g.Format(_T("%d"),ch);
 
		ch=AscW(c);
 
		g.Format(_T("%d"),ch);
	
 
		hex_string=Hex(AscW(c));
 
		if(hex_string.GetLength()<4)
		{
			hex_string=PadZero(hex_string,4);
		}
		EncodeUserData_16_bit=EncodeUserData_16_bit+hex_string;
	}
 
	return EncodeUserData_16_bit;
}



its convert the string in Unicode bytes only one problem is that

if I convert "hello" to Unicode its return "00680065006C006C006F" but this result mismatch at the end of process.

if in place of "00680065006C006C006F" the value is "680065006c006c006f00" the process successfully finish.

if u please guide me anyhow of help me to solve this, its so grateful to u.

thanks in advance.
AnswerRe: please help me to convert string in Unicode bytes? Pin
Richard MacCutchan21-Jan-14 23:06
mveRichard MacCutchan21-Jan-14 23:06 
GeneralRe: please help me to convert string in Unicode bytes? Pin
Le@rner22-Jan-14 1:09
Le@rner22-Jan-14 1:09 

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.