I'm trying to read one record at a time from a text file - putting the record, using strncpy, into a structure- then writing it to a binary file to be reused later as a binary file.

However, I'm having trouble converting the records to binary, I thought the following would work- and I have tried many variations- but it wont.

struct record{
char type = {"\0"}; /*one space then null*/
char sort[7] = {" \0"}; /*6 spaces then null*/
char part[21] = {" \0"}; /*20 spaces then null*/
};


Once the record is read into the structure I then use:

fprintf(newfile_ptr,"%c%7s%21s", etc........);

Is there something wrong with my syntax?