以下代码正常工作
//m_outputFilePath and m_moduleName are strings
std::string moduleVerilog;
// call Gen function to update moduleVerilog
std::ofstream moduleVerilogFile(m_outputFilePath + "\\" + m_moduleName + ".v");
if (moduleVerilogFile.is_open())
{
moduleVerilogFile << moduleVerilog;
moduleVerilogFile.close();
}
但是,如果我更改moduleVerilogFile
为:
std::ofstream moduleVerilogFile(m_outputFilePath + "\\Verilog\\" + m_moduleName + ".v");
没有写入文件,因为moduleVerilogFile.is_open()
返回 false 我应该显式生成Verilog
目录吗?(看起来很奇怪)