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

C / C++ / MFC

 
Generaldisplaying a jpg Pin
Tom Wright9-Jul-03 4:31
Tom Wright9-Jul-03 4:31 
GeneralRe: displaying a jpg Pin
John M. Drescher9-Jul-03 4:41
John M. Drescher9-Jul-03 4:41 
GeneralRe: displaying a jpg Pin
Ryan Binns9-Jul-03 4:59
Ryan Binns9-Jul-03 4:59 
GeneralRe: displaying a jpg Pin
PJ Arends9-Jul-03 11:25
professionalPJ Arends9-Jul-03 11:25 
GeneralReading very large files > 32G Pin
rdh9-Jul-03 4:23
rdh9-Jul-03 4:23 
GeneralRe: Reading very large files > 32G Pin
John M. Drescher9-Jul-03 4:30
John M. Drescher9-Jul-03 4:30 
GeneralRe: Reading very large files > 32G Pin
David Crow9-Jul-03 4:47
David Crow9-Jul-03 4:47 
QuestionWriting the actual addresses of a struct in memory??? Pin
johnstonsk9-Jul-03 4:22
johnstonsk9-Jul-03 4:22 
Let me see if I can explain this with shortness and clearity.


I am having to hard code the layout of a struct in memory.

Meaning that I have to hard code the actual memory location of each element in the struct.

Lets just say for simplicity that I have to start my first element at 0x0000.

The struct is layed out like this:
struct data<br />
{<br />
   double min[4];<br />
   double max[4];<br />
   char  name[4];<br />
   int   count;<br />
<br />
}


In order to create the struct in memory I think I need to create the layout of a byte(short word) like so:

typedef union u_do_word{<br />
  unsigned short word;<br />
  struct do_word_bits{<br />
    unsigned pad  : 8;<br />
    unsigned bit7 :1;<br />
    unsigned bit6 :1;<br />
    unsigned bit5 :1;<br />
    unsigned bit4 :1;<br />
    unsigned bit3 :1;<br />
    unsigned bit2 :1;<br />
    unsigned bit1 :1;<br />
    unsigned bit0 :1;<br />
  }bits;<br />
} do_word_t;



And create the pointer and variables for the elements
I put the hex address in the name.


start of the min array
<br />
  static do_word_t word_0x00;<br />
  static unsigned short *vme_word_0x00; //1st double in the min array<br />
  static do_word_t word_0x20;<br />
  static unsigned short *vme_word_0x20; //2nd double in the min array<br />
  static do_word_t word_0x40;<br />
  static unsigned short *vme_word_0x40; //3rd double in the min array<br />
  static do_word_t word_0x80;<br />
  static unsigned short *vme_word_0x80; //4th double in the min array


start of the max array
<br />
  static do_word_t word_0xA0;<br />
  static unsigned short *vme_word_0xA0; //1st double in the max array<br />
  static do_word_t word_0xC0;<br />
  static unsigned short *vme_word_0xC0; //2nd double in the max array<br />
  static do_word_t word_0xE0;<br />
  static unsigned short *vme_word_0xE0; //3rd double in the max array<br />
  static do_word_t word_0x100;<br />
  static unsigned short *vme_word_100; //4th double in the max array

start of the char array

This is the part that I am not sure about.
I believe that an unsigned short will give me the correct size for a double, but how should I do the char array.
Is this correct???

static do_word_t word_0x120;<br />
  static unsigned char *vme_word_0x120; //1st char in the name array <br />
<br />
  static do_word_t word_0x?????;   (??  0x124 ??)<br />
  static unsigned char *vme_word_0x?????; //2nd char in the name array <br />
<br />
  static do_word_t word_0x?????;    (??  0x128 ??)<br />
  static unsigned char *vme_word_0x?????; //3rd char in the name array <br />
<br />
  static do_word_t word_0x?????;     (??  0x12C ??)<br />
  static unsigned char *vme_word_0x?????; //4th char in the name array 


I am not sure how to step through the memory and create the correct size for the char array or the int at the end


Thanks for taking the time to read my winded message,
Steven
AnswerRe: Writing the actual addresses of a struct in memory??? Pin
John M. Drescher9-Jul-03 4:35
John M. Drescher9-Jul-03 4:35 
Generaltype &quot;double&quot; question Pin
DaveE9th9-Jul-03 4:11
DaveE9th9-Jul-03 4:11 
GeneralRe: type &quot;double&quot; question Pin
BoudewijnEctor9-Jul-03 4:14
BoudewijnEctor9-Jul-03 4:14 
GeneralRe: type &quot;double&quot; question Pin
DaveE9th9-Jul-03 4:25
DaveE9th9-Jul-03 4:25 
GeneralRe: type &quot;double&quot; question Pin
Cedric Moonen9-Jul-03 4:30
Cedric Moonen9-Jul-03 4:30 
GeneralRe: type &quot;double&quot; question Pin
David Crow9-Jul-03 4:34
David Crow9-Jul-03 4:34 
GeneralRe: type "double" question Pin
keegan9-Jul-03 4:19
keegan9-Jul-03 4:19 
GeneralRe: type &quot;double&quot; question Pin
Trollslayer9-Jul-03 4:23
mentorTrollslayer9-Jul-03 4:23 
GeneralRe: type &quot;double&quot; question Pin
DaveE9th9-Jul-03 4:32
DaveE9th9-Jul-03 4:32 
GeneralRe: type &quot;double&quot; question Pin
David Crow9-Jul-03 4:37
David Crow9-Jul-03 4:37 
GeneralRe: type &quot;double&quot; question Pin
Ryan Binns9-Jul-03 4:25
Ryan Binns9-Jul-03 4:25 
GeneralRe: type &quot;double&quot; question Pin
DaveE9th9-Jul-03 4:53
DaveE9th9-Jul-03 4:53 
GeneralNatural Language Processing open source Pin
JoeSox9-Jul-03 3:48
JoeSox9-Jul-03 3:48 
GeneralLoading ComboBox within a thread Pin
cycosi9-Jul-03 3:46
cycosi9-Jul-03 3:46 
GeneralRe: Loading ComboBox within a thread Pin
David Crow9-Jul-03 4:00
David Crow9-Jul-03 4:00 
GeneralCustom message in ClassWizzard Pin
Cedric Moonen9-Jul-03 3:23
Cedric Moonen9-Jul-03 3:23 
GeneralEasy question on DHTML Editing control Pin
Scozturk9-Jul-03 3:15
professionalScozturk9-Jul-03 3:15 

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.