我有一个像这样的静态构造函数:
File errorLog;
static this() {
try {
errorLog = File("./log/log.txt", "w");
} catch(Throwable ex) {
// STOP PROGRAM EXECUTION
}
}
打开文件失败时如何停止程序执行?
我有一个像这样的静态构造函数:
File errorLog;
static this() {
try {
errorLog = File("./log/log.txt", "w");
} catch(Throwable ex) {
// STOP PROGRAM EXECUTION
}
}
打开文件失败时如何停止程序执行?
使用 core.runtime 终止 druntime http://dlang.org/phobos/core_runtime.html#.Runtime.terminate并退出 core.stdc.stdlib