int main(void)
{
Book book={"The Weald of Youth","Siegfried Sassoon","autobiography"};
printf("%s\n%s\n%s\n", book.title, book.author, book.subject);
}
gives
Code:
The Weald of Youth
Siegfried Sassoon
autobiography
int main(void)
{
Book book={"The Weald of Youth","Siegfried Sassoon","autobiography"};
printf("%s\n%s\n%s\n", book.title, book.author, book.subject);
}
gives
Code:
The Weald of Youth
Siegfried Sassoon
autobiography
fwrite() writes a block of memory to a file, i.e. in binary, to be read later by a program using fread() or similar
if you require formatted output in human readable form use printf()
binary IO is used because it is more efficent (faster and the files are shorter) than formatted IO when one does not need the output to be human readable