Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #include <stdio.h>
- 2
- 3 int main(void)
- 4 {
- 5 FILE *fp_out;
- 6
- 7 char *str1 = "Four score and seven years ago our";
- 8 char *str2 = "fathers brought forth on this continent,";
- 9 char *str3 = "a new nation, conceived in Liberty and dedicated";
- 10 char *str4 = "to the proposition that all men are created equal.";
- 11
- 12 fp_out = fopen("my_file", "w");
- 13
- 14 if(fp_out != NULL)
- 15 {
- 16 fputs(str1, fp_out);
- 17 fputc('\n', fp_out);
- 18
- 19 fputs(str2, fp_out);
- 20 fputc('\n', fp_out);
- 21
- 22 fputs(str3, fp_out);
- 23 fputc('\n', fp_out);
- 24
- 25 fputs(str4, fp_out);
- 26 fputc('\n', fp_out);
- 27
- 28 fflush(fp_out);
- 29 fclose(fp_out);
- 30 }
- 31 else
- 32 printf("I couldn't open the file \"my_file\".\n");
- 33
- 34 return 0;
- 35 }
Add Comment
Please, Sign In to add comment