Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: difference between win32app & mfc Pin
kakan30-Jan-06 22:02
professionalkakan30-Jan-06 22:02 
GeneralRe: difference between win32app & mfc Pin
khan++30-Jan-06 22:20
khan++30-Jan-06 22:20 
GeneralRe: difference between win32app & mfc Pin
kakan31-Jan-06 0:18
professionalkakan31-Jan-06 0:18 
AnswerRe: difference between win32app & mfc Pin
khan++30-Jan-06 22:27
khan++30-Jan-06 22:27 
AnswerRe: difference between win32app & mfc Pin
toxcct31-Jan-06 0:36
toxcct31-Jan-06 0:36 
QuestionFocus does not return back to Button after the event handler for the button is executed Pin
GayathriNaveen30-Jan-06 21:32
GayathriNaveen30-Jan-06 21:32 
QuestionRe: Focus does not return back to Button after the event handler for the button is executed Pin
Prakash Nadar30-Jan-06 21:43
Prakash Nadar30-Jan-06 21:43 
QuestionHow to convert hex to string? Pin
Rostfrei30-Jan-06 20:20
Rostfrei30-Jan-06 20:20 
Hello!

I have some char array of hexadecimal values I get from the network. I want to convert them to some printable form. For example I did it like:

<br />
	string print_buff;<br />
<br />
	char buffer2[100] = {0x7f, 0x80, 0x1a};<br />
<br />
	for(int i = 0; i < 3; i++){<br />
		char a[3] = {0};<br />
		sprintf(a, "%2.0x", buffer2[i]);<br />
		print_buff.append(a, 2);<br />
	}<br />


This works well to the values 0x7f (127), but for the numbers bigger than 0x7f it doesn't work properly anymore. If I look at 'a[3]' character array (in debuger) I can see that 0x80 has converted to "ffffff80" string. How is this even possible when I limited string with formating option to 2? When I append characters afterwards, "ff" is appended not "80".



Rostfrei
AnswerRe: How to convert hex to string? Pin
Owner drawn30-Jan-06 20:43
Owner drawn30-Jan-06 20:43 
GeneralRe: How to convert hex to string? Pin
Rostfrei30-Jan-06 20:53
Rostfrei30-Jan-06 20:53 
GeneralRe: How to convert hex to string? Pin
Owner drawn30-Jan-06 20:59
Owner drawn30-Jan-06 20:59 
GeneralRe: How to convert hex to string? Pin
Rostfrei30-Jan-06 21:08
Rostfrei30-Jan-06 21:08 
AnswerRe: How to convert hex to string? Pin
Owner drawn30-Jan-06 21:08
Owner drawn30-Jan-06 21:08 
GeneralRe: How to convert hex to string? Pin
Rostfrei30-Jan-06 21:12
Rostfrei30-Jan-06 21:12 
AnswerRe: How to convert hex to string? Pin
Stephen Hewitt30-Jan-06 21:56
Stephen Hewitt30-Jan-06 21:56 
JokeRe: How to convert hex to string? Pin
Owner drawn30-Jan-06 22:38
Owner drawn30-Jan-06 22:38 
GeneralRe: How to convert hex to string? Pin
Rostfrei31-Jan-06 19:58
Rostfrei31-Jan-06 19:58 
AnswerRe: How to convert hex to string? Pin
Gary R. Wheeler31-Jan-06 1:05
Gary R. Wheeler31-Jan-06 1:05 
Questionsimple c++ code for multiuser environment Pin
Bobby Dreamer198530-Jan-06 20:18
Bobby Dreamer198530-Jan-06 20:18 
JokeRe: simple c++ code for multiuser environment Pin
Owner drawn30-Jan-06 22:40
Owner drawn30-Jan-06 22:40 
AnswerRe: simple c++ code for multiuser environment Pin
Gary R. Wheeler31-Jan-06 1:12
Gary R. Wheeler31-Jan-06 1:12 
QuestionSTLSoft challenge Pin
Danny-T230-Jan-06 19:54
Danny-T230-Jan-06 19:54 
Questionservice programming Pin
sudheer.ravuri30-Jan-06 18:38
sudheer.ravuri30-Jan-06 18:38 
Questionconfused Pin
swatgodjr30-Jan-06 18:32
swatgodjr30-Jan-06 18:32 
AnswerRe: confused Pin
khan++30-Jan-06 20:03
khan++30-Jan-06 20:03 

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.