File.Write
Skip to content
mnscript
StringResult File.Write(string, string, string) 

Description ​

Writes / overrides a file.

Arguments ​

string - The directory to place the file.
string - The file name to write.
string

Returns ​

StringResult - A StringResult representing the success/failure of the operation.

Example ​

msc
using File;
using Console;
using System;

// Writes the text "My text hello!" in to "my_file.txt" in "r/documents".

StringResult result = File.Write("r/documents", "my_file.txt", "My text hello!");

if(result.GetResult()){
    Console.WriteLine("The file was successfully written!");
}else{
    // If the file could not be written, the result string contains the reason.
    Console.WriteLine("Error: "..result.GetString());
}