Updating a file random
On one extreme, the programmer is in database denial, thinking they can get away with a flat file solution, and on the other extreme, they haven't thought about the design enough. One more thing I did solve that problem by using the String Buffer. One more thing I did solve that problem by using the String Buffer.Either way, my advice is to lie down until the urge to use RAF passes. I just wanted to know was there any way to do with Random Access File only? I just wanted to know was there any way to do with Random Access File only?Usually it's better to save a huge amount of data in multiple small files than having all data in one file, so a "design change" is better than using RAF.Just think of data corruption: Losing one small file, containing one record, is better than losing the big file that contains all records.While there are more steps involved for option 2, IMHO it is the easier option.Performance-wise, I'd think that option 1 is better.
Either way, my advice is to lie down until the urge to use RAF passes.
If you have a stand-alone program, and a huge amount of data (hunded of megabytes), it's faster to just store the data in a RAF and care for it yourself than accessing a database and let the database store it for you.
Especially if you don't want to install a database or configure it.
This means faster way of storage and less code to write.
Also if you write a database-application, you need RAF, which is used internally in every database.