Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- int contador;
- int c;
- int main(){
- FILE *fp;
- fp = fopen("./vish.txt", "r+");
- if (fp == NULL){
- printf("Ocorreu um erro ao abrir o arquivo!");
- return 1;
- }
- do{
- contador = fgetc(fp);
- if (contador == '\n'){
- c++;
- }
- } while (contador != EOF);
- printf("Existem %d linhas", c + 1
- );
- fclose(fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement