/* declare the test record as a 24-element byte array */ char testrec[24];
/* MAGIC: we load in the magic number */ testrec[0] = 0x47 ; testrec[1] = 0xf3 ; testrec[2] = 0x46 ; testrec[3] = 0xe3 ;
/* MACHID: SGI Unix workstation */ testrec[4] = 2 ;
/* NUMOBJECTS: We want to write out one object, so this can be either 0 or 1 */ testrec[5] = 0 ;
/* SPECA: We are using ASCII characters, and SGIs are big-endian machines */ testrec[6] = 0x01 ;
/* RESERVED1 */ testrec[7] = 0 ;
/* RECHDR: This is a C program using normal I/O functions, so the file will be a pure stream of bytes */ testrec[8] = 1 ;
/* RESERVED2 */ testrec[9] = 0 ;
/* SPECB: This is C, so we are using row-major array ordering, and our array indices start with zero */ testrec[10] = 0x00 ;
/* SLEN: a short integer is 16 bits on an SGI */ testrec[11] = 16;
/* LLEN: a long integer is 32 bits */ testrec[12] = 32;
/* FLEN: a floating-point number is 32 bits */ testrec[13] = 32;
/* DLEN: a double precision floating-point number is 64 bits */ testrec[14] = 64;
/* FPFORM: SGI machines use IEEE floating-point formats */ testrec[15] = 0x11;
/* RESERVED3 */ testrec[16] = 0 ; /* RESERVED4 */ testrec[17] = 0 ; /* RESERVED5 */ testrec[18] = 0 ; /* RESERVED6 */ testrec[19] = 0 ; /* RESERVED7 */ testrec[20] = 0 ; /* RESERVED8 */ testrec[21] = 0 ; /* RESERVED9 */ testrec[22] = 0 ; /* RESERVED10 */ testrec[23] = 0 ; /* now write out the record */ (void) fwrite( testrec, sizeof(char), 24, outfile);