Results 1 to 2 of 2
  1. #1
    rajanerode is offline Member
    Join Date
    Mar 2011
    Location
    Chennai,TamilNadu,India
    Posts
    1
    Rep Power
    0

    Cool Problem in File Creation

    I am a java beginner... I am doing a small standalone application.. In which i am using files..
    In my code i want to get customer details and to store it in a file..i am using following code for doing that...

    Java Code:
    File customer = new File("customer details.txt");
    FileOutputStream fop1 = new FileOutputStream(customer);
    fop1.write(customerName.getBytes());
    fop1.write(customerCompany.getBytes());
    fop1.write(customerAddress.getBytes());
    fop1.flush();
    fop1.close();
    But while using this code..for each execution one file is created and details getting added and in next execution the old file is deleted along with the details....but i need one file is to be created and only details to be added in each execution...help me pls.... :confused:

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    See the API docs for FileOutputStream, namely its varying constructors. There is a way to "open" the file in append mode.

Similar Threads

  1. PDF File creation Error
    By siva_vs_siva in forum New To Java
    Replies: 2
    Last Post: 12-24-2010, 01:42 AM
  2. Replies: 0
    Last Post: 11-26-2010, 11:10 PM
  3. JAR file creation
    By Cluster Storm in forum AWT / Swing
    Replies: 4
    Last Post: 06-10-2010, 04:38 AM
  4. Jar file creation
    By raghu9198 in forum New To Java
    Replies: 4
    Last Post: 01-11-2009, 04:40 AM
  5. Executable Jar File Creation
    By Doctor Cactus in forum New To Java
    Replies: 7
    Last Post: 11-13-2008, 04:31 AM

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
  •