hey folks,
i need a good reference(s) to binary files. if anyone knows of one or some, could you please let me know.
tnx,
ben
hey folks,
i need a good reference(s) to binary files. if anyone knows of one or some, could you please let me know.
tnx,
ben
What kind of reference information do you need?
-Prelude
My best code is written with the delete key.
um, i just need to see a bunch of examples
just want to get a quick look at the way things are done in terms of programming with binary files
i hope this has made a bit more clear.
tnx,
ben
Okay, fiddle around with this for starters
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> struct Record { char name[80]; } static sRec[3]; int main ( void ) { FILE *fp; strcpy ( sRec[0].name, "Julienne Walker" ); strcpy ( sRec[1].name, "Danny Raxter" ); strcpy ( sRec[2].name, "Amir Salyen" ); if ( ( fp = fopen ( "tst.txt", "wb" ) ) != NULL ) { (void)fwrite ( sRec, sizeof ( struct Record ), (size_t)3, fp ); (void)fclose ( fp ); } if ( ( fp = fopen ( "tst.txt", "rb" ) ) != NULL ) { (void)fread ( sRec, sizeof ( struct Record ), (size_t)1, fp ); (void)fclose ( fp ); } return EXIT_SUCCESS; }
My best code is written with the delete key.
Why are you casting the return value of your functions to void? Just curious, as there is no logical reason to do this.
Quzah.
Hope is the first step on the road to disappointment.
>Why are you casting the return value of your functions to void?
Because I like to see Lint say 'no warnings'
-Prelude
My best code is written with the delete key.