Solution for Exercise 22-3
ex2203
#include <stdio.h> #include <stdlib.h> int main() { FILE *fh; fh=fopen("hello.txt","w"); if(fh==NULL) { puts("Can't open that file!"); exit(1); } fprintf(fh,"Look what I made!\n"); fputs("My C program wrote this file.\n",fh); fclose(fh); return(0); }
Notes
* Refer to the notes for Exercise 22-1 for details on where Code::Blocks saves the hello.txt file.
Copyright © 1997-2024 by QPBC.
All rights reserved