Click here to Skip to main content
15,920,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Main window Pin
Mark Salsbery14-Sep-07 6:57
Mark Salsbery14-Sep-07 6:57 
AnswerRe: Main window Pin
led mike14-Sep-07 7:36
led mike14-Sep-07 7:36 
GeneralRe: Main window Pin
Mark Salsbery14-Sep-07 7:41
Mark Salsbery14-Sep-07 7:41 
QuestionConversion Problem Pin
Andy20214-Sep-07 4:47
Andy20214-Sep-07 4:47 
QuestionRe: Conversion Problem Pin
David Crow14-Sep-07 4:52
David Crow14-Sep-07 4:52 
AnswerRe: Conversion Problem Pin
Andy20214-Sep-07 5:05
Andy20214-Sep-07 5:05 
QuestionRe: Conversion Problem Pin
David Crow14-Sep-07 5:31
David Crow14-Sep-07 5:31 
AnswerRe: Conversion Problem Pin
Andy20214-Sep-07 9:45
Andy20214-Sep-07 9:45 
Thanks David. The code below seems to work OK.

But I am sure they must be a better way to get the result!

unsigned short w1 = 0xc3f5;    // The float is 3.14<br />
unsigned short w2 = 0x4840;<br />
union<br />
{<br />
	float data;<br />
	unsigned short buff[2];<br />
	BYTE floating[4];<br />
}convert;<br />
<br />
convert.floating[0] = (BYTE)(w1/256);		// This gives val = 3.1400001<br />
convert.floating[1] = (BYTE)(w1 & 0x00FF);<br />
convert.floating[2] = (BYTE)(w2/256);<br />
convert.floating[3] = (BYTE)(w2 & 0x00FF);<br />
<br />
//convert.buff[1] = w1;				// This gives val = -490.56445<br />
//convert.buff[0] = w2;<br />
<br />
float val = convert.data;

GeneralRe: Conversion Problem Pin
Russell'14-Sep-07 7:20
Russell'14-Sep-07 7:20 
AnswerRe: Conversion Problem Pin
Russell'14-Sep-07 4:54
Russell'14-Sep-07 4:54 
AnswerRe: Conversion Problem Pin
Nathan Holt at EMOM14-Sep-07 10:30
Nathan Holt at EMOM14-Sep-07 10:30 
GeneralRe: Conversion Problem Pin
Andy20214-Sep-07 11:24
Andy20214-Sep-07 11:24 
Questionstring or int? Pin
VonHagNDaz14-Sep-07 4:16
VonHagNDaz14-Sep-07 4:16 
AnswerRe: string or int? Pin
Christian Graus14-Sep-07 4:17
protectorChristian Graus14-Sep-07 4:17 
GeneralRe: string or int? Pin
VonHagNDaz14-Sep-07 4:20
VonHagNDaz14-Sep-07 4:20 
GeneralRe: string or int? Pin
led mike14-Sep-07 4:29
led mike14-Sep-07 4:29 
GeneralRe: string or int? Pin
VonHagNDaz14-Sep-07 4:32
VonHagNDaz14-Sep-07 4:32 
GeneralRe: string or int? Pin
led mike14-Sep-07 4:44
led mike14-Sep-07 4:44 
GeneralRe: string or int? Pin
VonHagNDaz14-Sep-07 4:53
VonHagNDaz14-Sep-07 4:53 
GeneralRe: string or int? Pin
David Crow14-Sep-07 4:23
David Crow14-Sep-07 4:23 
QuestionUnsure of reason for error. Pin
Chris Meech14-Sep-07 4:02
Chris Meech14-Sep-07 4:02 
AnswerRe: Unsure of reason for error. Pin
jhwurmbach14-Sep-07 4:07
jhwurmbach14-Sep-07 4:07 
GeneralRe: Unsure of reason for error. Pin
Chris Meech14-Sep-07 4:40
Chris Meech14-Sep-07 4:40 
GeneralRe: Unsure of reason for error. Pin
jhwurmbach14-Sep-07 4:46
jhwurmbach14-Sep-07 4:46 
AnswerRe: Unsure of reason for error. Pin
Mark Salsbery14-Sep-07 7:04
Mark Salsbery14-Sep-07 7:04 

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.