-
String in TXT problem
I print a String with that method :
Code:
PrintWriter pw;
pw = new PrintWriter(new FileOutputStream("FichierResultat.txt"));
pw.println(sListeGagnant);
pw.close();
and i am supposed to got that :
Code:
***** Résultats de la lotterie du Père Noël *****
Nombre de participants: 66
Montant de la recette: 660.0
Combinaison gagnante: 15105
===== Liste des gagnants =====
GOUDSOUZIAN ARI 3 sur 5 35125
CHRISTIN FRANCOIS 3 sur 5 15136
===== Montant de lots =====
2 gagnant(s) 3 sur 5 16.5 chacun
0 gagnant(s) 4 sur 5 0.0 chacun
0 gagnant(s) 5 sur 5 0.0 chacun
but when I go check in the .txt all newline is blackbox and in one line ??? Why ? Please help me it's for my final work and I have to send all for monday...that the only bug I have :(
-
if you need more information just post what you need, it's an important question please.
-
have you tried just using the print() method, and adding in the carriage returns yourself?
-
I used \n in the string to make the return, in the DOS windows all is ok but when I print it in a .txt it doesnt work well.
-
I think hes getting carriage returns.
-
I get this too, but I haven't worried about it too much. I usually get this if I use Notepad. Try viewing in Wordpad instead--it usually resolves text file incompatibilities.
Of that's not good enough and you take the previous advice of using print() and appending a \n to the end of your strings and find that that doesn't work either, try appending \r\n instead.
cudabean