#include <stdio.h>
#include <stdlib.h>
void readFile(char file[]) {
FILE *fp = fopen(file, "r");
char ch;
while ((ch = fgetc(fp)) != EOF)
putchar(ch);
fclose(fp);
}
int main()
{
char file[100] = "d:\\data.txt";
FILE *fp = fopen(file, "a"); // a - append
if (fp == NULL) {
printf("Error open file\n");
exit(EXIT_FAILURE);
}
fputs("\njava python", fp); // append text
fclose(fp);
readFile(file);
return 0;
}
/*
run:
c c++ c#
java python
*/