[Insight-developers] So... What platforms DON'T have stdint?
(WAS discussion of 64bit niftilib lossage)
Sean McBride
sean at rogue-research.com
Tue Jul 24 14:34:19 EDT 2007
On 7/24/07 1:22 PM, kent williams said:
>For analyze and NIfTI files, the header HAS to be 348 bytes long, otherwise
>it isn't an Analyze/NIfTI file. In that case, you'd have to read in 348
>bytes, and then use offsets + casts to extract individual fields.
A portable solution would be something like this:
// Set up structure packing for all supported compilers
#if defined(__GNUC__)
#define START_FORCE_STRUCT_PACKING #pragma pack(1)
#define END_FORCE_STRUCT_PACKING #pragma pack()
#elif defined(_MSC_VER)
// something else
#else // other compilers
#error todo
#endif
#include <stdint.h>
START_FORCE_STRUCT_PACKING
struct
{
uint8_t field1;
int32_t field2;
uint16_t field3;
// etc.
};
END_FORCE_STRUCT_PACKING
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the Insight-developers
mailing list