how to open a file?

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

  1. sweetheart89115

    sweetheart89115

    Joined:
    Oct 31, 2007
    Messages:
    3
    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. 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. THY
    Replies:
    4
    Views:
    512
    Gönen EREN
    Aug 22, 2003
  2. ml
    Replies:
    0
    Views:
    1,450
  3. ml
    Replies:
    2
    Views:
    4,851
    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:
    427
    Jens.Toerring@physik.fu-berlin.de
    Aug 22, 2003
  5. Schüle Daniel

    File::open and File.open

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

Share This Page