PDA

View Full Version : Editing a text file?



Jimmie
10-06-2004, 07:10 AM
I'm just moving from APMS4 to APMS5 and I'm having trouble figuring out how to edit a text file based on user supplied information. In version 4 I used:

TextFile.DeleteLine("%SrcDir%\BIN\autoplay.dat",1)
TextFile.InsertLine("%SrcDir%\BIN\autoplay.dat","%_ContractID%",1)

I need to search and replace text or a known line number. How can this be done in version 5.

Any help would be appreciated.

Stefan_M
10-06-2004, 01:58 PM
Maybe

Read the textfile into a string: TextFile.ReadToString ()
Make your changes
Write new String to Textfile: TextFile.WriteFromString ( )


Stefan_M

Jimmie
10-06-2004, 02:31 PM
Thanks for the tip. It work great.

I guess I was associating a string with a single line instead of an entire file.