Category : C Source Code
Archive   : CBIBLE.ZIP
Filename : FWRITE.C

 
Output of file : FWRITE.C contained in archive : CBIBLE.ZIP
/* fwrite.c, from p. 439 of Turbo C Bible */
#include
char buffer[80] = "Testing fwirte\n\This is the second line.\n";
main()
{
int numwrite;
FILE *infile;
char filename[80];
printf("Enter name of a file to write to: ");
gets(filename);
/* Open the file for writing */
if ((infile = fopen(filename, "wb")) == NULL)
{
printf("fopen failed.\n");
exit(0);
}
/* Write 80 characters and display the */
/* buffer */
numwrite = fwrite((void *)buffer, sizeof(char), 80, infile);
printf("%d characters written to file %s\n", numwrite, filename);
printf("use 'TYPE %s' to see if it worked\n", filename);
}

  3 Responses to “Category : C Source Code
Archive   : CBIBLE.ZIP
Filename : FWRITE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/