Hi,
I've been using some code helpfully supplies by Mike Buess to add a header line to an existing text via an indrect approach using a tmeporary copy.
The code :
%L="add_this_line"; // the line you want to insert
if(exist(C:\origin 6.1\temp.txt)>0) file.remove(C:\Origin 6.1\temp.txt);
file.nlinemode=0; // see discussion in preceding paragraph
fp1=file.open(C:\Origin 6.1\temporary\%U); // open data file for reading
fp2=file.open(C:\origin 6.1\temp.txt,2); // open (create) a file for read/write
file.lwrite(L,fp2); // start new file with the insertion;
// This loop is fine with 6.1 but endless with 7.5!
for(i=1;i>0;)
{
if(file.lread(Z,fp1)==0) break; // read a line from fp1
file.lwrite(Z,fp2); // write it to fp2
};
file.close(fp1);
file.close(fp2);
file -c "C:\origin 6.1\temp.txt" "C:\Origin 6.1\temporary\%U"; // replace data file with new file
file.remove(C:\origin 6.1\temp.txt); // delete temporary file
works fine with 6.1 but, where commented, appears stuck in a loop with 7.5. I'd really appreciate some help/comment thanks.
Cheers,
pete