Click here to Skip to main content
15,919,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to send byte (Device) Pin
Cedric Moonen19-Oct-04 3:09
Cedric Moonen19-Oct-04 3:09 
QuestionHow to convert a byte array to decimal integer? Pin
ting66818-Oct-04 22:08
ting66818-Oct-04 22:08 
AnswerRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong18-Oct-04 22:36
Lim Bio Liong18-Oct-04 22:36 
AnswerRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong18-Oct-04 22:36
Lim Bio Liong18-Oct-04 22:36 
AnswerRe: How to convert a byte array to decimal integer? Pin
David Crow19-Oct-04 2:49
David Crow19-Oct-04 2:49 
GeneralRe: How to convert a byte array to decimal integer? Pin
ting66818-Oct-04 22:57
ting66818-Oct-04 22:57 
GeneralRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong19-Oct-04 18:00
Lim Bio Liong19-Oct-04 18:00 
GeneralRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong18-Oct-04 23:18
Lim Bio Liong18-Oct-04 23:18 
Hello Ting,

The size of the byte array must be exactly 4 bytes in intel platforms (4 bytes being 32 bits).

The reason why I use an "unsigned char" array is because a byte in programming terms is essentially an unsigned 8-bit character. So use "unsigned char" instead of "char".

If your byte array is smaller than 4 bytes, reset it to 4 bytes and pad the missing bytes with zero. E.g. :

instead of :

// Byte array to represent 0x00112233.
unsigned char ucByteArray[3] = { 0x33, 0x22, 0x11 };

make this :

// Byte array to represent 0x00112233.
unsigned char ucByteArray[4] = { 0x33, 0x22, 0x11, 0x00 };

Remember the byte ordering of Intel platforms : a two byte short integer with value 0x1122 is represented in memory bytes as :

0x22 <-- first byte.
0x11 <-- second byte.

Your byte array must not be larger than 4 bytes. This would be an error.

Best Regards,
Bio.

GeneralRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong18-Oct-04 23:31
Lim Bio Liong18-Oct-04 23:31 
GeneralRe: How to convert a byte array to decimal integer? Pin
ting66818-Oct-04 23:32
ting66818-Oct-04 23:32 
GeneralRe: How to convert a byte array to decimal integer? Pin
Lim Bio Liong18-Oct-04 23:46
Lim Bio Liong18-Oct-04 23:46 
QuestionCan't change the font and text color of an edit box using CFontDialog ? Pin
VCSharp00718-Oct-04 20:47
VCSharp00718-Oct-04 20:47 
AnswerRe: Can't change the font and text color of an edit box using CFontDialog ? Pin
22491718-Oct-04 21:26
22491718-Oct-04 21:26 
GeneralMaximize MDI Child window when Main window is maximized Pin
ledallam18-Oct-04 20:45
ledallam18-Oct-04 20:45 
GeneralRe: Maximize MDI Child window when Main window is maximized Pin
Azghar Hussain18-Oct-04 22:38
professionalAzghar Hussain18-Oct-04 22:38 
GeneralFtpOpenFile Error Pin
antonimasso18-Oct-04 20:41
antonimasso18-Oct-04 20:41 
General2 DirectX questions Pin
Cedric Moonen18-Oct-04 20:26
Cedric Moonen18-Oct-04 20:26 
Questionhow can i used this struct. Pin
maranatha18-Oct-04 20:26
maranatha18-Oct-04 20:26 
AnswerRe: how can i used this struct. Pin
bryce18-Oct-04 20:36
bryce18-Oct-04 20:36 
AnswerRe: how can i used this struct. Pin
Cedric Moonen18-Oct-04 20:47
Cedric Moonen18-Oct-04 20:47 
GeneralRe: how can i used this struct. Pin
Anonymous19-Oct-04 14:41
Anonymous19-Oct-04 14:41 
AnswerRe: how can i used this struct. Pin
David Crow19-Oct-04 2:52
David Crow19-Oct-04 2:52 
GeneralRe: how can i used this struct. Pin
Anonymous19-Oct-04 14:39
Anonymous19-Oct-04 14:39 
GeneralRe: how can i used this struct. Pin
David Crow20-Oct-04 3:00
David Crow20-Oct-04 3:00 
GeneralTab control with mdi Pin
vc-programmer-18-Oct-04 19:27
vc-programmer-18-Oct-04 19:27 

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.