Written by

Question ED Coder · Sep 18, 2018

getting an error: Method does not exist when trying to create a file

I am trying to create a file from within a zen page but it keeps giving me a method does not exist error

in my page, i am taking the values and writing them to a file, when I do this :

 set filename= ##class(%Library.File).New("E:\test\file.txt") it gives me an error

Would appreciate some guidance on this.

Comments

Eduard Lebedyuk · Sep 18, 2018

It's better to use file streams.

Set stream = ##class(%Stream.FileCharacter).%New()
Set sc = stream.LinkToFile("E:\test\file.txt")
Do stream.Write("Some Text")
Set sc = stream.%Save()
0
ED Coder  Sep 18, 2018 to Eduard Lebedyuk

Thank you so much Eduard, this solved my issue.  Thank you for the advice, and the solution, really appreciate it

0