Results 1 to 3 of 3
  1. #1
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default Need help formatting File Output

    I am using java.io.FileWriter to save the program data....
    It doesn't see the'\n'....just writes in big long lines. I should know the answer to this, but could anyone refresh me on how to get carraige returns in my output using FileWriter or another class?


    I found the answer in my book PrintWriter....is the class sorry
    Last edited by aaroncarpet; 11-26-2009 at 06:25 PM. Reason: feeling real stupid

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,783
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by aaroncarpet View Post
    I am using java.io.FileWriter to save the program data....
    It doesn't see the'\n'....just writes in big long lines. I should know the answer to this, but could anyone refresh me on how to get carraige returns in my output using FileWriter or another class?
    Wrap your FileWriter in a PrintWriter and you can use more convenient methods such as print() and println().

    kind regards,

    Jos

  3. #3
    aaroncarpet's Avatar
    aaroncarpet is offline Senior Member
    Join Date
    Nov 2009
    Location
    California
    Posts
    147
    Rep Power
    0

    Default

    Yeah I am changing all my filewriters to printwriters duh I feel really retarded for not knowing that

Similar Threads

  1. Writting output to file!
    By hakan123 in forum New To Java
    Replies: 8
    Last Post: 11-19-2009, 05:39 PM
  2. Need help formatting output and some code
    By A5i19 in forum New To Java
    Replies: 6
    Last Post: 11-09-2009, 05:58 AM
  3. No output to file
    By shiva in forum Java Servlet
    Replies: 0
    Last Post: 04-24-2009, 03:06 PM
  4. Replies: 7
    Last Post: 11-19-2008, 03:09 PM
  5. Writing to excel file erasing existing formatting
    By jmHoekst in forum New To Java
    Replies: 1
    Last Post: 09-16-2008, 06:58 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •