Click here to Skip to main content
15,916,280 members
Home / Discussions / C#
   

C#

 
QuestionC# coding Pin
DammyMulero7-Aug-11 18:54
DammyMulero7-Aug-11 18:54 
AnswerRe: C# coding Pin
Richard MacCutchan7-Aug-11 21:52
mveRichard MacCutchan7-Aug-11 21:52 
AnswerRe: C# coding Pin
BobJanova7-Aug-11 23:14
BobJanova7-Aug-11 23:14 
AnswerRe: C# coding Pin
#realJSOP8-Aug-11 1:49
professional#realJSOP8-Aug-11 1:49 
GeneralRe: C# coding Pin
Not Active8-Aug-11 1:53
mentorNot Active8-Aug-11 1:53 
AnswerRe: C# coding Pin
V.8-Aug-11 2:16
professionalV.8-Aug-11 2:16 
AnswerRe: C# coding Pin
PIEBALDconsult8-Aug-11 2:48
mvePIEBALDconsult8-Aug-11 2:48 
QuestionHow do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling7-Aug-11 11:04
stephen.darling7-Aug-11 11:04 
Hi.

Please consider the following fixed values...

unsigned int value1 = 396;


unsigned int value2 = 398565;

1) The above values will change, but value1 will always be 3 digits, and value2 will always be 6 digits.

How do I....

A) Place both values into one DWORD?

b) Encode it as a 4 byte array.

So, as an example (not actual values)

396 + 398565 -> (DWORD) = 396398565 -> BYTE[] = {0x00, 0x00, 0x00, 0x00 } (whatever the hex would be)


And then, I would need to reverse it, although I think I have the code working to do that, but cant test it properly until I can get the above to work.

Thank you,
Steve
AnswerRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
PIEBALDconsult7-Aug-11 13:44
mvePIEBALDconsult7-Aug-11 13:44 
AnswerRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
Luc Pattyn7-Aug-11 15:32
sitebuilderLuc Pattyn7-Aug-11 15:32 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
PIEBALDconsult7-Aug-11 18:02
mvePIEBALDconsult7-Aug-11 18:02 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling8-Aug-11 4:48
stephen.darling8-Aug-11 4:48 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
PIEBALDconsult8-Aug-11 16:37
mvePIEBALDconsult8-Aug-11 16:37 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling8-Aug-11 5:08
stephen.darling8-Aug-11 5:08 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
PIEBALDconsult8-Aug-11 15:31
mvePIEBALDconsult8-Aug-11 15:31 
AnswerRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
BobJanova7-Aug-11 23:12
BobJanova7-Aug-11 23:12 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling8-Aug-11 4:45
stephen.darling8-Aug-11 4:45 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling8-Aug-11 5:28
stephen.darling8-Aug-11 5:28 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
BobJanova8-Aug-11 7:30
BobJanova8-Aug-11 7:30 
AnswerRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
Matt Meyer8-Aug-11 6:55
Matt Meyer8-Aug-11 6:55 
GeneralRe: How do I store two int values into one DWORD, and then convert it to a 4 byte array? Pin
stephen.darling8-Aug-11 7:38
stephen.darling8-Aug-11 7:38 
QuestionIs this the same? Pin
stephen.darling7-Aug-11 10:07
stephen.darling7-Aug-11 10:07 
AnswerRe: Is this the same? Pin
PIEBALDconsult7-Aug-11 10:20
mvePIEBALDconsult7-Aug-11 10:20 
GeneralRe: Is this the same? Pin
stephen.darling7-Aug-11 10:33
stephen.darling7-Aug-11 10:33 
GeneralRe: Is this the same? Pin
BobJanova7-Aug-11 23:10
BobJanova7-Aug-11 23:10 

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.