regarding file operation

Discussion in 'Java' started by tamilarasiramesh@gmail.com, Oct 5, 2006.

  1. Guest

    I have written code for writing into text file...It is appended in the
    same line...i want to append line by line(incase of student
    details)..so that i have used "\n" in between strings..but it is not
    working..
    give me the solution,,thanks in advance
    , Oct 5, 2006
    #1
    1. Advertising

  2. Oliver Wong Guest

    <> wrote in message
    news:...
    >I have written code for writing into text file...It is appended in the
    > same line...i want to append line by line(incase of student
    > details)..so that i have used "\n" in between strings..but it is not
    > working..
    > give me the solution,,thanks in advance


    Use a PrintWriter

    http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintWriter.html

    - Oliver
    Oliver Wong, Oct 5, 2006
    #2
    1. Advertising

  3. wrote:
    > I have written code for writing into text file...It is appended in the
    > same line...i want to append line by line(incase of student
    > details)..so that i have used "\n" in between strings..but it is not
    > working..
    > give me the solution,,thanks in advance


    Try with System.getProperty("line.separator") instead of "\n".

    Or better use PrintWriter or PrintStream.

    Arne
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Oct 6, 2006
    #3
  4. Guest

    Oliver Wong wrote:

    > <> wrote in message
    > news:...
    > >I have written code for writing into text file...It is appended in the
    > > same line...i want to append line by line(incase of student
    > > details)..so that i have used "\n" in between strings..but it is not
    > > working..
    > > give me the solution,,thanks in advance

    >
    > Use a PrintWriter
    >
    > http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintWriter.html
    >
    > thank you,it was working.. - Oliver
    , Oct 6, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. O.B.
    Replies:
    0
    Views:
    465
  2. david ullua
    Replies:
    13
    Views:
    651
  3. Replies:
    20
    Views:
    518
    Random832
    Dec 19, 2006
  4. raan
    Replies:
    2
    Views:
    440
  5. Buzz Lightyear
    Replies:
    10
    Views:
    1,106
    Alexander Bartolich
    Aug 12, 2009
Loading...

Share This Page