file output in java : Notepad gives weird results
- From: ankur <ankur.a.agarwal@xxxxxxxxx>
- Date: Sat, 29 Mar 2008 18:58:41 -0700 (PDT)
I used the following code to write output to a file.
FileOutputStream fout = new FileOutputStream(fname,true);
PrintStream ps = new PrintStream(fout);
Random r = new Random(10);
for(int i = 0 ; i <= r1-1; i++)
{
for (int j = 0 ; j <= c1-1; j++)
{
m1[i][j] = r.nextInt(10);
//System.out.println(m1[i][j]);
ps.print(m1[i][j]);
ps.printf("\n");
}
//ps.printf("\r");
}
ps.close();
fout.close();
}
with this code if I read the output file in notepad I get all junk
characters written out. Like this:
ਲ਼ਰਲ਼ਰਸ਼ਸ਼
But if I open this file in textpad the output is fine:
3
0
3
0
6
6
However if I uncomment
//ps.printf("\r");
Output in notepad is surprising. There are no new lines: 303066
But textpad is fine !
Don't understand what is happening !?
.
- Follow-Ups:
- Re: file output in java : Notepad gives weird results
- From: Roedy Green
- Re: file output in java : Notepad gives weird results
- From: Chase Preuninger
- Re: file output in java : Notepad gives weird results
- From: Wayne
- Re: file output in java : Notepad gives weird results
- From: Arne Vajhøj
- Re: file output in java : Notepad gives weird results
- Prev by Date: Re: Byte to float conversion problem - PLEASE HELP
- Next by Date: Re: file output in java : Notepad gives weird results
- Previous by thread: Byte to float conversion problem - PLEASE HELP
- Next by thread: Re: file output in java : Notepad gives weird results
- Index(es):
Relevant Pages
|
|