Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

I need to open a file and write it. Im trying to use IFILE_Seek to go a particular location and write, im unable to do it..
my text file is
str1= 123454
str2= 342526

i need to append some data in str1 (str1= 123456789)
is dat possible? any help?

Hi Vicky,
It's standard file I/O that you cant append to the end of a line. Only to the end of a file. What I'd do is create a temp file and read through the original file writing to the temp file. When you get to the desired line, write out the new (appended line). Write out the rest of the lines. At the end, delete the original file and rename the temp file.
Or you might re-examine the issue. Perhaps a database approach or an XML design might be a better solution to your problem.

Hi Vicky,
It's standard file I/O that you cant append to the end of a line. Only to the end of a file. What I'd do is create a temp file and read through the original file writing to the temp file. When you get to the desired line, write out the new (appended line). Write out the rest of the lines. At the end, delete the original file and rename the temp file.
Or you might re-examine the issue. Perhaps a database approach or an XML design might be a better solution to your problem.

Hey thanks for the info..

Hey thanks for the info..