| | |
editing file
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
As I do not know which exactly writer you using only thing I can say is to look for append() method which will be either directly implemented in used writer class or inherited from other classes above this one
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
•
•
Hi,I need to edit in a file without deleting all the data.
Thanks
anyway, open notepad, type something, close and save it.
re-open the file, add a line, press 'ctrl+s' and your job is done.
don't need to thank me, the bill 'll come later

if your task is to create an application that does such, start writing code, begin with the easy parts, and come back here when you get stuck.
when you do so, post the relevant code, post what it should do, post what it is doing, post any error messages and whatever you think WE think might be relevant
•
•
Join Date: May 2008
Posts: 13
Reputation:
Solved Threads: 0
first i know how to open a file and write in it and save it I'm not gonna waste my time for such a thing.second my problem is i write to the file customer data and then the customer can edit it so i want to edit this data in the file (adding the new one and deleting the old data)I opened a temp file but it's not working can i do it without temp files?how?.
Thanks
Thanks
•
•
•
•
first i know how to open a file and write in it and save it I'm not gonna waste my time for such a thing.second my problem is i write to the file customer data and then the customer can edit it so i want to edit this data in the file (adding the new one and deleting the old data)I opened a temp file but it's not working can i do it without temp files?how?.
Thanks
just overwrite what you want to change
@nouryn - if you can provide better description of user editing process we may able to help. However right now as you can see from the responses it is not clear what you try to do. Some supporting coding would be welcome...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Are you familiar with the 'append' argument of the FileWriter ?
When you try to write to the file, the new data will be appended after the existing
Java Syntax (Toggle Plain Text)
BufferedWriter writer= new BufferedWriter(new FileWriter(file, true));
When you try to write to the file, the new data will be appended after the existing
Check out my New Bike at my Public Profile at the "About Me" tab
•
•
Join Date: May 2008
Posts: 13
Reputation:
Solved Threads: 0
hi,sorry that i didn't describe my program clear enough.
i have a file contain the following
123 Nouryn current =5000
124 Jasmine investment =300
the customer want to add to his account 300 so i search for his name and then search for ("=")so he take the credit and store it so the customer can add on it.
the user want to add 300 so the new credit will be 5300 this data must be written in the file but after deleting the old one how to do it.
now i;m trying to put the new data and the old ones in a new file but only the data after the edited line is written:s.i've attach my code hope i explained well this time.
help plllllllllllllllzzzzzzzzzzzzzz
i have a file contain the following
123 Nouryn current =5000
124 Jasmine investment =300
the customer want to add to his account 300 so i search for his name and then search for ("=")so he take the credit and store it so the customer can add on it.
the user want to add 300 so the new credit will be 5300 this data must be written in the file but after deleting the old one how to do it.
now i;m trying to put the new data and the old ones in a new file but only the data after the edited line is written:s.i've attach my code hope i explained well this time.
help plllllllllllllllzzzzzzzzzzzzzz
A simple way to do it is read the entire file and store its data somewhere (for example a Vector). Then change the credit in the Vector, after you find the right element, and save the Vector with the new data back to the file
Check out my New Bike at my Public Profile at the "About Me" tab
![]() |
Similar Threads
- EDITING file (C++)
- Edit sendmain aliases file. (Perl)
- Text File Editing Help Required. (Windows NT / 2000 / XP)
- How to populate an array? from a FILE (C)
- Error trying to write to existing file (C)
- C++ Error : opening file a second time for a read (C++)
Other Threads in the Java Forum
- Previous Thread: JTable
- Next Thread: Date and Time in GUI
| Thread Tools | Search this Thread |
2dgraphics android api apple applet application arguments array arrays automation banking binary binarytree bluetooth capture chat chatprogramusingobjects class classes client code color component count database derby design eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie object os print printing problem producer program programming project projectideas read recursion reference replaysolutions ria scanner screen server set size sms sort sourcelabs sql stop string swing threads transforms tree ui unicode validation windows






