Click here to Skip to main content
15,891,033 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: please help me to convert string in Unicode bytes? Pin
Richard MacCutchan22-Jan-14 1:27
mveRichard MacCutchan22-Jan-14 1:27 
QuestionGradient detection for pic micros Pin
Senned20-Jan-14 2:27
Senned20-Jan-14 2:27 
AnswerRe: Gradient detection for pic micros Pin
CPallini20-Jan-14 3:15
mveCPallini20-Jan-14 3:15 
GeneralRe: Gradient detection for pic micros Pin
Senned20-Jan-14 3:23
Senned20-Jan-14 3:23 
GeneralRe: Gradient detection for pic micros Pin
CPallini20-Jan-14 3:28
mveCPallini20-Jan-14 3:28 
GeneralRe: Gradient detection for pic micros Pin
Senned20-Jan-14 3:37
Senned20-Jan-14 3:37 
QuestionRe: Gradient detection for pic micros Pin
CPallini20-Jan-14 7:09
mveCPallini20-Jan-14 7:09 
GeneralRe: Gradient detection for pic micros Pin
Senned20-Jan-14 20:58
Senned20-Jan-14 20:58 
GeneralRe: Gradient detection for pic micros Pin
CPallini20-Jan-14 21:36
mveCPallini20-Jan-14 21:36 
QuestionGradient detection for pic micros Pin
Senned20-Jan-14 2:27
Senned20-Jan-14 2:27 
QuestionDicom dcmqsc Pin
Member 1017436318-Jan-14 3:12
Member 1017436318-Jan-14 3:12 
AnswerRe: Dicom dcmqsc Pin
Richard MacCutchan18-Jan-14 4:14
mveRichard MacCutchan18-Jan-14 4:14 
GeneralRe: Dicom dcmqsc Pin
Member 1017436319-Jan-14 2:46
Member 1017436319-Jan-14 2:46 
GeneralRe: Dicom dcmqsc Pin
Richard MacCutchan19-Jan-14 2:56
mveRichard MacCutchan19-Jan-14 2:56 
QuestionStill wise to use Microsoft Foundation Classes (MFC) version 11? Pin
oscar196616-Jan-14 13:21
oscar196616-Jan-14 13:21 

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.