1 Reply Latest reply: Nov 16, 2008 9:37 AM by 807589 RSS

    Why can't I get a new line using PrintWriter

    807589
      why can't I get a new line in my file when writing out to the file like this.

      try{
           
                for(int a = 0;a<10;a++)
                {
           
                fow = new FileWriter("c:\\San Data\\"+myFilesStrings[4].substring(0,6)+".PRN");
                     bwr = new BufferedWriter(fow);
                     pow = new PrintWriter(bwr,false);
                     
                     //pow.write("new\n"+ "old");
                     pow.write(myFilesStrings[4]+"\n"+myFilesStrings[5]);
                     //System.out.println(myFilesStrings[4]+"4");
                     //JOptionPane.showMessageDialog(null,"HelloIN" + myFilesStrings[a]);
                     
                     
                     pow.close();
                     bwr.close();
                     fow.close();
                }
           }
           //BufferedWriter bwr = new BufferedWriter(fwr);
           catch(IOException e){System.out.println(e);e.printStackTrace();         }

      the +"\n" above in the pow.wirte... is not working!

      Can anyone tell me why? Thanks in advance....