Create a file

All I want to do is create a new file in the current directory using the filename of my choice.
I do not want show the “ShowOpenFileDialog” bit just create a file on mine own.
Might be silly question but have searched the help any every sample asks the user for a filename.

Thanks for any help.
(Going for a Cuppa)

First, create a FolderItem for the directory you want. SpecialFolder will help here.

Then create a child to the file you want to create.

Finally, use TextOutputStream (assuming it’s a text file) to create the file.

Something like this:

var cwd as FolderItem = SpecialFolder.CurrentWorkingDirectory
var myFile as FolderItem = cwd.Child( "My File.txt" )

var tos as TextOutputStream = TextOutputStream.Create( myFile )
tos.Write someData
tos.Close

thank you for that was pulling my hair out trying verious combinations but not the one
you have come up with.

Cheers and have a nice day.
(enjoying my cuppa now)