BookmarkSubscribe
Choose Language Hide Translation Bar
dg1
dg1
Occasional Contributor

Adding extra line before saving text file

I currently have a for loop in which I am saving the content into seperate text files. Before I save each file I want to add an empty row at the start of each file (because I plan on manually adding information later).  My current approaches seem to not work. Do you guys have any suggestions?

0 Kudos
1 REPLY 1
txnelson
Super User

Re: Adding extra line before saving text file

Something like this might work:

// Save the file
dt << save( "c:/mydata/test.txt" );
// read it backin
xx=load text file("c:/mydata/test.txt");
// add the first line
xx=xx || " \!n";
// write the file back
save text file("c:/mydata/test.txt",xx);
Jim