>> I know that fread() uses a void type buffer, but is it best to use std type buffers like char?<<
fread() doesn't use a "void buffer", it simply takes a void pointer as it parameter denoting where to write to. The sector of memory it's writing to could be anything, to fread(), it's just a sequence of bytes.
>>does using the code like above write a btree page structure to file in orderly fashion in order of keycount 1st<<
Well, it's fread(), so it'll read not write.
With regards to fwrite: The contents of the structure will be written out exactly as it is stored in memory.
To help you understand, try this simple program:
It simply writes a structure to a file, then reads it back in.
foo.i = 11;
foo.j = 22;
if ((fp = fopen("file.bin","w+b")) == NULL)
fwrite (&foo, sizeof(foo), 1, fp);
foo.i = 0; foo.j = 0;
fread (&foo, sizeof(foo), 1, fp);
printf ("i: %d\nj: %d\n", foo.i, foo.j);
>> am I better off converting the btree page structure contents into characters<<
This will depend on your requirements. Writing a structure to a file is quick and easy, but the file itself will not be portable to other platforms. So if you want to share data between Unix and Windows, I'd suggest outputing in a character based format.