cs_amel2006
Messages postés83Date d'inscriptionsamedi 21 janvier 2006StatutMembreDernière intervention 9 décembre 2006
-
12 avril 2006 à 22:01
Twinuts
Messages postés5375Date d'inscriptiondimanche 4 mai 2003StatutModérateurDernière intervention14 juin 2023
-
13 avril 2006 à 00:21
je lit un fichier et je le met dans un string et mon problème est que mon string ne contient pa le debut de fichier et je ne sais pas pourquoi voici mon code:
Code:
,
----
public static void main (String [] argv) throws IOException
{
String g= fichtostr("f1.txt");
}
public static String fichtostr(String nomf)
{
char tout[] = {'r'};
try {
File sourceF = new File(nomf);
long grandComment = sourceF.length();
tout = new char[(int)grandComment];
FileReader f = new FileReader(sourceF);
int dejaLu = 0;
while (dejaLu < grandComment) {
dejaLu = dejaLu + f.read(tout, dejaLu, (int)grandComment-dejaLu);
}
}
catch (IOException e) {
System.err.println(" Cela ne marche pas. Voila." + e.toString());
}
return new String(tout);