file output in java : Notepad gives weird results



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 !?



.



Relevant Pages

  • Re: file output in java : Notepad gives weird results
    ... PrintStream ps = new PrintStream; ... with this code if I read the output file in notepad I get all junk ... But if I open this file in textpad the output is fine: ... Output in notepad is surprising. ...
    (comp.lang.java.programmer)
  • Re: Whats the cream of Search Engine Software?
    ... I hope not, since Notepad is really not that useful, there are so many ... free replacements that are much and much better. ... Textpad is not free (ok, ... separate tool. ...
    (alt.internet.search-engines)
  • Re: SS view opens notepad instead of printing to stdout or -O file
    ... Maybe it's something that textpad or some other application did to your ... > As I wrote in my previous message, I have removed the Editor setting, ... No mention of Notepad anywhere except in the list ... > Joe Masters wrote: ...
    (microsoft.public.vstudio.sourcesafe)
  • Re: View source app
    ... I replaced UltraEdir32 by TextPad. ... However, I can't change to Word, Excel or notepad from the Tools/Internet ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Read a file locked by another program
    ... Presumably because of the reason you state. ... There has to be a way around this because Textpad and even Notepad can ... only be requesting read. ...
    (microsoft.public.vb.winapi)