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. Advertisements

  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. Advertisements

  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. Advertisements

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. Marc S. Gibian

    Rigorous File operation error checking

    Marc S. Gibian, Jul 15, 2003, in forum: Perl
    Replies:
    2
    Views:
    1,307
    Andrew Savige
    Jul 22, 2003
  2. J Gao
    Replies:
    0
    Views:
    1,344
    J Gao
    Jul 28, 2003
  3. djc

    file copy operation

    djc, Jan 19, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    535
  4. O.B.
    Replies:
    0
    Views:
    578
  5. david ullua
    Replies:
    13
    Views:
    927
  6. Replies:
    20
    Views:
    660
    Random832
    Dec 19, 2006
  7. raan
    Replies:
    2
    Views:
    620
  8. Buzz Lightyear
    Replies:
    10
    Views:
    1,354
    Alexander Bartolich
    Aug 12, 2009
Loading...