Avatar of ang3lus
ang3lus
 asked on

java file input and output handling

Hi
can someone help to deal with file
i have file that has format:
E008,Michelle,1980, manager, 17000
E008,George,1970, manager, 10600
E008,Jonathan,1940, manager, 25000

i don't have any problem with reading or writing to file

my question is:
there is a quick way to update specific element in file like salary
How i can while i am reading from file change element from specific line like salary
for example
E008,Michelle,1980, manager, 17000
E008,Michelle,1980, manager, 0

thanks
Programming Languages-OtherJava

Avatar of undefined
Last Comment
for_yan

8/22/2022 - Mon
SOLUTION
CEHJ

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
for_yan

You cannot update one line or one item in the file,
you need to read the whole file and re-write it to a new
plcae and while doing it you can parse the contents get to the element you need and replace it.
ASKER CERTIFIED SOLUTION
for_yan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ang3lus

ASKER
thanks
for_yan

Just a word of caution - I'm sure you know but just in case: when running and especially debugging this sort of programs
in real life certainly make sure that you have copies of all your files - there's nothing easier to do thhan to lose
your the whole file with one wrong operator.
Your help has saved me hundreds of hours of internet surfing.
fblack61