Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Update data of text file

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Update data of text file

    Hello guys

    I have a text file and name is test.txt
    and the data are as

    1 a1 a2 a3
    2 b1 b2 b3
    3 c1 c2 c3
    4 d1 d2 d3

    ................
    I can add record to the test file. but I can't update the record
    I want to update record as

    2 b11 b22 b33

    and how can I delete record of 2???

    help me guys


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,625
    Thanks
    45
    Thanked 1,959 Times in 1,933 Posts

    Default Re: Update data of text file

    Read the whole file into a String, update the String and write out the updated String replacing the existing file.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. How to read different data segments from a text file?
    By alutchman in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 18th, 2013, 01:35 PM
  2. Reading data from a text file into an object
    By surfbumb in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 6th, 2011, 08:37 PM
  3. Replies: 8
    Last Post: March 25th, 2011, 02:34 PM
  4. Cannot update data in .txt/.csv file
    By Azriq007 in forum JDBC & Databases
    Replies: 2
    Last Post: October 16th, 2010, 09:16 PM
  5. Read data from text file
    By yroll in forum Algorithms & Recursion
    Replies: 4
    Last Post: December 31st, 2009, 12:40 AM