Click here to Skip to main content
15,886,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: I now have an MFC example project that highlights my issue. Pin
S.T.K6-Dec-15 23:25
S.T.K6-Dec-15 23:25 
GeneralRe: Adding a new button to and existing CMFCRibbonBar "tab" Pin
S.T.K10-Dec-15 2:37
S.T.K10-Dec-15 2:37 
AnswerRe: Adding a new button to and existing CMFCRibbonBar "tab" Pin
S.T.K17-Dec-15 23:55
S.T.K17-Dec-15 23:55 
QuestionC++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
Satish Shankar Jagtap3-Dec-15 23:54
Satish Shankar Jagtap3-Dec-15 23:54 
AnswerRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
CPallini4-Dec-15 0:17
mveCPallini4-Dec-15 0:17 
AnswerRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
Jochen Arndt4-Dec-15 1:45
professionalJochen Arndt4-Dec-15 1:45 
GeneralRe: C++ - Accessibility of object after deletion. (illegal still working), why this is happening? Pin
CPallini4-Dec-15 9:18
mveCPallini4-Dec-15 9:18 
QuestionFloating point conversion Pin
Still learning how to code3-Dec-15 22:19
Still learning how to code3-Dec-15 22:19 
I am in the process of trying to code the transmission of floating point data over an ethernet cable. I decided to send two bytes, the first with the "whole" part and the second with the "fractional" part (but as an unsigned char). The first byte works fine, but the second (trivial) part is giving me a strange (to me) problem which is driving me nuts - I can't see WHAT I'm getting wrong. Here is the test code:-

float flTest = 0.04;
float flResult;
flResult = flTest * 100;
unsigned char ucResult;
ucResult = (unsigned char)flResult;

flResult ends up as 4.00000 which is correct, but ucResult gives 3 !!
If I change flTest to 0.05, ucResult is 4 !!

There is clearly a decrementation involved here, but I can't understand why !

I'm sure that when some kind soul explains it, I shall be kicking myself - HARD !!
Doug

AnswerRe: Floating point conversion Pin
Michael_Davies3-Dec-15 22:29
Michael_Davies3-Dec-15 22:29 
GeneralRe: Floating point conversion Pin
Richard MacCutchan3-Dec-15 22:40
mveRichard MacCutchan3-Dec-15 22:40 
GeneralRe: Floating point conversion Pin
Michael_Davies4-Dec-15 21:08
Michael_Davies4-Dec-15 21:08 
GeneralRe: Floating point conversion Pin
Richard MacCutchan4-Dec-15 22:12
mveRichard MacCutchan4-Dec-15 22:12 
AnswerRe: Floating point conversion Pin
Richard MacCutchan3-Dec-15 22:39
mveRichard MacCutchan3-Dec-15 22:39 
AnswerRe: Floating point conversion Pin
Jochen Arndt3-Dec-15 23:10
professionalJochen Arndt3-Dec-15 23:10 
GeneralRe: Floating point conversion Pin
Still learning how to code5-Dec-15 0:29
Still learning how to code5-Dec-15 0:29 
AnswerRe: Floating point conversion Pin
CPallini3-Dec-15 23:30
mveCPallini3-Dec-15 23:30 
GeneralRe: Floating point conversion Pin
k50544-Dec-15 4:21
mvek50544-Dec-15 4:21 
QuestionIEEE 754-1985 Pin
enhzflep4-Dec-15 5:43
enhzflep4-Dec-15 5:43 
AnswerRe: Floating point conversion Pin
S.T.K8-Dec-15 3:19
S.T.K8-Dec-15 3:19 
QuestionComboboxx issue in MFC Pin
Amrit Agr3-Dec-15 2:48
Amrit Agr3-Dec-15 2:48 
SuggestionRe: Comboboxx issue in MFC Pin
Richard MacCutchan3-Dec-15 3:50
mveRichard MacCutchan3-Dec-15 3:50 
QuestionVisual Studio error LNK2005: variable XXX redefined in xxx.obj Pin
Javier Luis Lopez26-Nov-15 0:09
Javier Luis Lopez26-Nov-15 0:09 
AnswerRe: Visual Studio errYou should declare it or LNK2005: variable XXX redefined in xxx.obj Pin
Richard MacCutchan26-Nov-15 0:24
mveRichard MacCutchan26-Nov-15 0:24 
GeneralRe: Visual Studio errYou should declare it or LNK2005: variable XXX redefined in xxx.obj Pin
Javier Luis Lopez26-Nov-15 0:53
Javier Luis Lopez26-Nov-15 0:53 
GeneralRe: Visual Studio errYou should declare it or LNK2005: variable XXX redefined in xxx.obj Pin
Richard MacCutchan26-Nov-15 1:11
mveRichard MacCutchan26-Nov-15 1:11 

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.