0
My problem is simple, I created a following file listing some movies:
What I want is to literally read what is inside and print on the terminal, I am aware of the existence of functions of reading files(fscanf, fgets...) but they do not seem to suit my situation, because this function asks to pass a string per parameter, however I have no string in my code, so I understood reading the documentation of these functions, the string would be given by the user, however I do not have this string in my code, I want this string to be actually all my text contained already inside the file. `#include
include
int main (void) {
FILE *arquivo;
char texto[760]; // variável "place holder" pra considerar o texto do bloco
de notas
arquivo=fopen("lista.txt","r"); // abertura do arquivo pra leitura
if(arquivo==NULL) {
printf("ERROR");
exit(1);
}
fgets(texto, 759, arquivo); // fgets usado de forma totalmente errada, pois não sabia oq passar no lugar da string
fclose(arquivo);
printf("%s", arquivo); `
Thank you in advance!
Thank you very much! really after doing what you said I managed to print right the list!
– DaProgrammer0101