How to delete some characters or a line from a file using ATEasy commands?

John K.
Bacau,

Nov 10, 2011
55 Posts

0  |  0  

Re: How to delete some characters or a line from a file using ATEasy commands?

Hi there! How can I delete some characters (or a whole string line) from a text file using ATEasy file I/O commands? Any help is welcomed.

Solution Available
DrATEasy (Ron Y.)
Mission Viejo, CA

Nov 10, 2011
358 Posts

1  |  0  

Re: How to delete some characters or a line from a file using ATEasy commands?

There no such command in ATEasy or C/Windows API. You will have to read the whole file to a string, close it, remove the line using string manipulation functions and rewrite the file.
Another way is to read a line at a time from the file in a loop using FileRead with terminator "\r\n" and write to another file just the lines you need. At the end you can delete the old file and rename the new one to the old.

John K.
Bacau,

Nov 10, 2011
55 Posts

0  |  0  

Re: How to delete some characters or a line from a file using ATEasy commands?

Thank you for the quick and accurate answer, Ron! Have a nice day!



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]