document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. [...]
  2. FILE *pArquivo;
  3. int nLinhas = 0;
  4. char caracter;
  5. char palavra[100];
  6.  
  7. if((pArquivo=fopen("meuArquivo.txt", "r")) != NULL){
  8.           while(fscanf(pArquivo, "%c", &caracter) != EOF){
  9.             if(caracter == \'\\n\'){
  10.               nLinhas+=1;
  11.             }
  12.           }
  13.             // Aqui está o problema, pois o ponteiro pArquivo não está mais na posição inicial
  14.             for(i=0; i<rand()%nLinhas+1; i++){
  15.               fscanf(pArquivo, "%s\\n", &palavra);
  16.             }
  17. fclose(pArquivo);
  18. [...]
');