You should operate on it as on any other structure - fill it field by field (byte by byte) using regular memory-manipulating operations, like:

Qt Code:
  1. struct myStruct *ptr = (myStruct*)file_memory;
  2. ptr->field1 = 1;
  3. ptr->field2 = 2;
To copy to clipboard, switch view to plain text mode 

For simple structures (meaning ones that consist only of primitive types) this should be enough.