Question : read files in c
Answered by : josejuanse
#include<stdio.h>
int main(){ FILE *in=fopen("name_of_file.txt","r"); char c; while((c=fgetc(in))!=EOF) putchar(c); fclose(in); return 0;
}
Source : | Last Update : Thu, 07 May 20
Question : write to file in c programming
Answered by : stupid-shrike-iejojj9s7thy
[...] printf("Enter name: \n"); if (fgets(name, sizeof name, stdin)) { fputs(name,fileptr); fclose(fileptr); printf("File write was successful\n"); } else { printf("Read error.\n"); }
Source : https://stackoverflow.com/questions/8115218/writing-user-input-to-a-file-in-c | Last Update : Sun, 16 May 21