Question
· Apr 21, 2017

Write Stream to File only when stream is finished

I am using a  %Stream.FileCharacter object  and LinkToFile API to write to a file on a folder. The file is written line by line . Something like  below:-

Set tStream =   ##class(%Stream.FileCharacter).%New()

Set tStatus =tStream.LinkToFile("MyFileName")

For i=1:1:X  { Set result = ..process(i) Do tSream.WriteLine(result) }

 An external process then picks up the file at a designated time. Sometimes the process to create this file takes longer than expected and the result is that the external process picks up an incomplete file !! Is there a way to do the write only after the stream is completely written?

Discussion (1)1
Log in or sign up to continue