RosettaCodeData/Task/Write-entire-file/PureBasic/write-entire-file.basic

17 lines
416 B
Plaintext

EnableExplicit
Define fOutput$ = "output.txt" ; enter path of file to create or overwrite
Define str$ = "This string is to be written to the file"
If OpenConsole()
If CreateFile(0, fOutput$)
WriteString(0, str$)
CloseFile(0)
Else
PrintN("Error creating or opening output file")
EndIf
PrintN("Press any key to close the console")
Repeat: Delay(10) : Until Inkey() <> ""
CloseConsole()
EndIf