2
Which C language function allows you to open file .txt
and run other functions in the contents of this .txt
?
2
Which C language function allows you to open file .txt
and run other functions in the contents of this .txt
?
6
In essence is the fopen()
which opens and then has a set of functions that are used to manipulate the data and access the file contents and finally close the file. But there are a lot of ways to access files that can meet different needs of this, most operating system-specific Apis. Basic example:
// Abre o arquivo em modo de escrita estendida (leitura/gravação)
// e retorna um ponteiro para um file stream (fluxo de arquivo).
FILE *file = fopen("arquivo.txt", "w+");
char str[101];
// Lê 101 bytes do arquivo texto e joga na variável str.
fscanf(file, "%s", str);
// Exibe em tela o conteúdo lido do arquivo texto.
printf("|%s|\n", str);
// Fecha o arquivo texto.
fclose(file);
I put in the Github for future reference.
There is nothing ready that opens, loads all content and makes available. C doesn’t have this "stacks included" philosophy, you have to do everything you want besides the basics and if you know how to do it in general you can use this function in all your applications.
Browser other questions tagged c filing-cabinet txt file-get-contents
You are not signed in. Login or sign up in order to post.