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

C / C++ / MFC

 
GeneralRe: Hide cursor on CEdit? Pin
David Crow1-Nov-07 4:44
David Crow1-Nov-07 4:44 
GeneralRe: Hide cursor on CEdit? Pin
Gofur Halmurat1-Nov-07 4:49
Gofur Halmurat1-Nov-07 4:49 
QuestionConvert a char[ ] to int[ ] Pin
NYTSX31-Oct-07 4:59
NYTSX31-Oct-07 4:59 
AnswerRe: Convert a char[ ] to int[ ] Pin
Nelek31-Oct-07 5:10
protectorNelek31-Oct-07 5:10 
GeneralRe: Convert a char[ ] to int[ ] Pin
NYTSX31-Oct-07 5:19
NYTSX31-Oct-07 5:19 
AnswerRe: Convert a char[ ] to int[ ] [modified] Pin
George L. Jackson31-Oct-07 5:23
George L. Jackson31-Oct-07 5:23 
GeneralRe: Convert a char[ ] to int[ ] Pin
NYTSX31-Oct-07 7:28
NYTSX31-Oct-07 7:28 
GeneralRe: Convert a char[ ] to int[ ] Pin
Roger Stoltz31-Oct-07 7:57
Roger Stoltz31-Oct-07 7:57 
As I interpret your initial post, you may not get what you want with the proposed union solution.

NYTSX wrote:

tempChar[0] = 0x00;
tempChar[1] = 0x11;
tempChar[2] = 0x22;
tempChar[3] = 0x33;
tempChar[4] = 0x44;
tempChar[5] = 0x55;
tempChar[6] = 0x66;
tempChar[7] = 0x77;


This would in all systems, regardless of byte ordering, generate the following memory contents:
00 11 22 33 44 55 66 77

If you convert the memory contents above to two adjacent 32-bit integers you will, on a little-endian system like most systems running windows, get 0x33221100 and 0x77665544.

NYTSX wrote:
how do I get
tempInt[0] = 0x00112233;
tempInt[1] = 0x44556677;


My point is that the union solution will work on a big-endian system, but not on a little-endian system in terms of how I interpret your question.
To make a portable solution you would have to walk through the char array, one element at a time, and shift the integer value like Nelek suggested.



"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown

GeneralRe: Convert a char[ ] to int[ ] Pin
George L. Jackson31-Oct-07 8:06
George L. Jackson31-Oct-07 8:06 
QuestionRe: Convert a char[ ] to int[ ] Pin
David Crow31-Oct-07 10:23
David Crow31-Oct-07 10:23 
AnswerRe: Convert a char[ ] to int[ ] Pin
George L. Jackson31-Oct-07 17:14
George L. Jackson31-Oct-07 17:14 
AnswerRe: Convert a char[ ] to int[ ] Pin
Cedric Moonen31-Oct-07 5:26
Cedric Moonen31-Oct-07 5:26 
GeneralRe: Convert a char[ ] to int[ ] Pin
toxcct31-Oct-07 5:31
toxcct31-Oct-07 5:31 
AnswerRe: Convert a char[ ] to int[ ] Pin
toxcct31-Oct-07 5:30
toxcct31-Oct-07 5:30 
AnswerRe: Convert a char[ ] to int[ ] Pin
Robert Surtees1-Nov-07 10:22
Robert Surtees1-Nov-07 10:22 
QuestionFlickering Problem Pin
mcsherry31-Oct-07 4:28
mcsherry31-Oct-07 4:28 
AnswerRe: Flickering Problem Pin
Mark Salsbery31-Oct-07 5:22
Mark Salsbery31-Oct-07 5:22 
GeneralRe: Flickering Problem Pin
mcsherry31-Oct-07 5:33
mcsherry31-Oct-07 5:33 
AnswerRe: Flickering Problem Pin
mcsherry31-Oct-07 6:00
mcsherry31-Oct-07 6:00 
GeneralRe: Flickering Problem Pin
Mark Salsbery31-Oct-07 6:21
Mark Salsbery31-Oct-07 6:21 
Questionhow to splice two images with diffrent palette? Pin
King Tran31-Oct-07 4:25
King Tran31-Oct-07 4:25 
AnswerRe: how to splice two images with diffrent palette? Pin
Chris Losinger31-Oct-07 8:50
professionalChris Losinger31-Oct-07 8:50 
GeneralRe: how to splice two images with diffrent palette? Pin
King Tran4-Nov-07 2:53
King Tran4-Nov-07 2:53 
QuestionHow to move done project to another computer? Pin
Gofur Halmurat31-Oct-07 4:11
Gofur Halmurat31-Oct-07 4:11 
AnswerRe: How to move done project to another computer? Pin
Cedric Moonen31-Oct-07 4:17
Cedric Moonen31-Oct-07 4:17 

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.