CS2263/Final/FinalCode/io/iotext.c

19 lines
384 B
C
Raw Normal View History

2023-05-22 23:28:51 -03:00
#include <stdio.h>
int main() {
FILE *fp;
fp = fopen("iotext.txt", "w");
if (fp == NULL) {
printf("Error opening file\n");
return 1;
}
fprintf(fp, "CS2263!\n");
fclose(fp);
fp = fopen("iotext.txt", "r");
char c;
do {
c = getc(fp);
putchar(c);
} while (c != EOF);
fclose(fp);
return 0;
}