BobNoobGuy
BobNoobGuy

Reputation: 1645

Openedge add text at the beginning of an existing text file

Found some kb on append text at the end of an xml file

https://knowledgebase.progress.com/articles/Article/P8379

OUTPUT TO VALUE ("cust.xml") APPEND.
/* Append a new line character to the end of the file */
PUT UNFORMATTED "~n ".
/* Append some text after the new line character */
PUT UNFORMATTED "this is the appended text".
OUTPUT CLOSE.

is there similar solution to add text at the beginning? or I have to resort to import the file and rewriting it to a new file?

thank you

Upvotes: 0

Views: 1184

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

You are going to have to read it and re-write it. This is one way to do it:

define variable fileBody as longchar no-undo.

copy-lob from file "test" to fileBody.

fileBody = "new first line~n" + fileBody.

copy-lob from fileBody to file "test".

Upvotes: 4

Related Questions