Olá galera, Como posso ler e escrever no mesmo arquivo? Preciso abrir um arquivo que já existe e escreve no fim de cada linha desse arquivo Ex: My_file: a b c d e f g h i Saida: a b c XX d e f XX g h i XX Tentei isso mas o arquivo não foi alterado #include <stdio.h> #include <stdlib.h> int main() { FILE *f; f = fopen("file.txt", "a+"); while (fgets(line,sizeof(line),f)){ fputc("XX",f); } fclose(f); return 0; } Tentei abrir em outros modos mas nada,