question on using format in struct module
Suresh
mj_dup at yahoo.com
Thu Oct 25 10:17:00 EDT 2001
Chris,
Thanks for your suggestions ! Here is the snippet of code which writes
the binary file. Can you help me out specifying what the format would
be in this case for struct module ?
Chris Barker <chrishbarker at home.net> wrote in message
> If you still can't figure this out, send us some information about the
> file (maybe a snippet of the code that wrote it), or ask the person who
> wrote the code that created the file to help you with the format
> string(s).
================================================================================
================================================================================
// Write the magic number which are integer.
//
// MAGIC_NUMBER_2X - Plan parameters, inspected/accepted status
// MAGIC_NUMBER_30 (this is an integer) - Extends 2X by storing
// prescription parameters
// and the dose engine settings
// ---------------------------------------------------------------
(void)fwrite(MAGIC_NUMBER_30, MAGIC_NUMBER_SIZE, 1, fo);
//--- write out the magic number
// In the old Rplan we wrote out the plan description here,
// but I don't write out anything b/c we don't have a
// description to our plans.
//-----------------------------------------------------------
char description[128];
sprintf(description, "Rplan 3.0 Plan file");
(void)fwrite(description, sizeof(description), 1, fo);
// save the centerpoints
//--------------------------
(void)fwrite(¢erpts, sizeof(int), 1, fo);
for (i = 0; i < centerpts; i++)
{
currIsocPnt = getIsocPnt(i);
(void)fwrite(&(currIsocPnt.y()), sizeof(float), 1, fo);
(void)fwrite(&(currIsocPnt.x()), sizeof(float), 1, fo);
(void)fwrite(&(currIsocPnt.z()), sizeof(float), 1, fo);
}
// save the Cum Arcs
//----------------------
(void)fwrite(&cumArcs, sizeof(int), 1, fo);
================================================================================
================================================================================
Since number of CenterPoints vary for each input data given to the
software and this value being not fixed, I am unable to decide upon
how many floats should I provide to the "format" variable in struct
module ? I should find out if there is any dynamic way of telling
python code.
Thank you,
./Suresh
More information about the Python-list
mailing list