file get contents
void main() {
try {
string file = "data.txt";
string content;
FileUtils.get_contents(file, out content);
stdout.printf("%s\n", content);
} catch (FileError e) {
stderr.printf("%s\n", e.message);
}
}
Api
參考來源
- Basic Vala Samples / Reading and Writing Text File Content