首页 文章

在静态构造函数中退出D程序

提问于
浏览
1

我有一个像这样的静态构造函数:

File errorLog;
static this() {
    try {
        errorLog = File("./log/log.txt", "w");
    } catch(Throwable ex) {
        // STOP PROGRAM EXECUTION
    }
}

当文件打开失败时,如何停止程序执行?

1 回答

相关问题