multiple character
#include <stdio.h>
int main()
{
FILE* fp;
char c;
fp = fopen("file.txt", "w"); // using write mode
while ((c = getchar()) != EOF) // iterating until EOF
putc(c, fp); // putting a character
fclose(fp);
fp = fopen("file.txt", "r"); // using read mode
while ((c = getc(fp)) != EOF) // iterating till EOF
printf("%c", c); // printing to our screen
fclose(fp);
return 0;
}
Last updated