Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [...]
- FILE *pArquivo;
- int nLinhas = 0;
- char caracter;
- char palavra[100];
- if((pArquivo=fopen("meuArquivo.txt", "r")) != NULL){
- while(fscanf(pArquivo, "%c", &caracter) != EOF){
- if(caracter == '\n'){
- nLinhas+=1;
- }
- }
- rewind(pArquivo);
- for(i=0; i<rand()%nLinhas+1; i++){
- fscanf(pArquivo, "%s\n", &palavra);
- }
- fclose(pArquivo);
- [...]
Add Comment
Please, Sign In to add comment