How to Append an Existing Text file

Vineeth.RVineeth.R Member Posts: 121
Dear Friends,

Please advise how to append(add) values to an existing text file in Navision.


thanks and regards
vineeth.r
Thanks and Regards
Vineeth.R

Answers

  • kinekine Member Posts: 12,562
    Try this...
    File.WriteMode := true;
    File.OPEN('MyFile.TXT');
    File.POS(File.LEN); //set position in file to the end
    File.Write(...);
    File.Close;
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    open the file in textmode (if it is a textfile) and in write mode. Use for this the variable FILE.
    Then set the pointer to the END of the file.

    Edit: Kine was faster, he posted the source that i described.

    Regards
    Do you make it right, it works too!
  • Vineeth.RVineeth.R Member Posts: 121
    thanks friends
    Thanks and Regards
    Vineeth.R
  • pmusupmusu Member Posts: 55
    Problem solved.
  • carboncarbon Member Posts: 22
    edited 2017-11-08
    The statement "File.POS(File.LEN);" throws error "The return value should be used for this function.". The statement File.Seek(File.Len) should be used instead of "File.POS(File.LEN);". Therefore it could be nice if Vineeth.R share his solution.
Sign In or Register to comment.