how to open a file?

Discussion in 'Java' started by sweetheart89115, Nov 1, 2007.

  1. sweetheart89115

    sweetheart89115

    Joined:
    Oct 31, 2007
    Messages:
    3
    Likes Received:
    0
    I have a server which is always sending data, and I want to keep sending this data to a file. I tried using the following:



    try{
    file= FileOutputStream("modem.txt");
    new PrintStream(file).println(new String(in));
    file.close();
    }
    catch (IOException e){System.err.println("error");
    System.exit(-1);}

    But my data is always been overwritten, I want to keep the old and new data.

    Is there any way to keep sending data into a file without overriding the old data?
     
    sweetheart89115, Nov 1, 2007
    #1
    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. THY
    Replies:
    4
    Views:
    654
    Gönen EREN
    Aug 22, 2003
  2. ml
    Replies:
    0
    Views:
    1,651
  3. ml
    Replies:
    2
    Views:
    5,140
    John C. Bollinger
    Nov 30, 2004
  4. Corne' Cornelius

    multiple open fd's on open(file)

    Corne' Cornelius, Aug 22, 2003, in forum: C Programming
    Replies:
    2
    Views:
    539
    Jens.Toerring@physik.fu-berlin.de
    Aug 22, 2003
  5. tiewknvc9
    Replies:
    12
    Views:
    1,575
    Chris Uppal
    Feb 19, 2007
  6. Gunnar G

    where does open open the file?

    Gunnar G, Jan 21, 2006, in forum: C++
    Replies:
    10
    Views:
    601
  7. scad
    Replies:
    4
    Views:
    1,176
    James Kanze
    May 28, 2009
  8. Schüle Daniel

    File::open and File.open

    Schüle Daniel, Oct 23, 2006, in forum: Ruby
    Replies:
    4
    Views:
    452
    Rick DeNatale
    Oct 24, 2006
Loading...