Bonjour,
Je desire trouver un mot dans un fichier texte et ma fonction ne marche pas,voici mon code...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
public void trouvermot(String fich,String mot)
 
 {   String cf ="c:\\"+fich+".txt"; 
      try { 
  FileReader rd = new FileReader(cf); 
  StreamTokenizer st = new StreamTokenizer(rd); 
 
  int token = st.nextToken(); 
 
  while (token != StreamTokenizer.TT_EOF) { 
            token = st.nextToken(); 
            String word = st.sval; 
      if(word.startsWith(mot))
                System.out.print("mot touvé"); 
 } 
    rd.close(); 
    } catch (IOException e) { 
    }
}
Merci pour votre aide bonne journée