I hope your not trying to dump the struct straight to disk, since thats highly unportable (who's to say another system structures the struct the same in memory as your system does?)
Create a function to dump the struct to disk, then create another one to read it:
Code:
typedef struct mystruct_t {
char * blah;
unsigned short int whoCares;
} mystruct;
void WriteToDisk(const char * f, const mystruct * ms)
{
FILE * theFile;
/* open the file */
fprintf("%s%d", ms->blah, ms->whoCares); /* look at the modifiers of printf(), use them to control the width of the strings & numbers you write */
return;
}
void ReadFromDisk(const char * f, mystruct * ms)
{
/* cbf */
}