Last active
June 11, 2020 21:20
-
-
Save CaaioSB/27544d04d4713e942728bc34f51d92e7 to your computer and use it in GitHub Desktop.
Análise e Desenvolvimento de Sistemas: Atividade em C - 1º Semestre
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| void main() | |
| { | |
| int contador = 0; | |
| char linha[64]; | |
| FILE *fp; | |
| fp = fopen("arquivo.txt", "r"); | |
| if (fp != NULL) | |
| { | |
| while (!feof(fp)){ | |
| fgets(linha, 64, fp); | |
| if (!feof(fp)){ | |
| contador++; | |
| printf("%i - %s", contador, linha); | |
| } | |
| } | |
| } | |
| else{ | |
| printf("Arquivo inválido."); | |
| } | |
| system("pause > nul"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment