> But this structure has ints and char* s.
Code:
struct foo {
  int a;
  char *b;
};
Are you saying this (with lots of members) is 512 bytes?
If it really does contain pointers, you can't write the whole thing in one step, and the result is almost certainly not going to be 512 bytes all the time.

Or are you being lazy with your terminology, and you really have a char array in your struct
Code:
struct foo {
  int a;
  char b[510];
};
Are you saying this is 512 bytes?
This you could write out to disk in one step, and it would always occupy 512 bytes.

Post your actual struct, and we'll tell you the best way(s) to write it to disk.