Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ExecutarFuncao1(estrutura_dados_t *estrutura) {
- FILE *ficheiro;
- char texto[MAX_TEXTO_PARAGRAFO];
- char *palavra;
- ficheiro = fopen(estrutura->NomeFicheiro, "r");
- if (!ficheiro) {
- printf("\nFicheiro %s não encontrado!\n", estrutura->NomeFicheiro);
- return;
- }
- else {
- while (!feof(ficheiro)) {
- // Ler palavras do ficheiro
- fgets(texto, MAX_TEXTO_PARAGRAFO, ficheiro);
- palavra = strtok(texto, DELIMITADOR_PALAVRAS);
- while (palavra != NULL) {
- inserir_palavra_lista_inicio(estrutura->lista, palavra);
- palavra = strtok(NULL, DELIMITADOR_PALAVRAS);
- }
- } // Fim do While
- } // Fim do Else
- system("cls");
- printf("\nAcabado com sucesso\n");
- system("pause");
- fclose(ficheiro);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement