当我尝试使用此功能时,我在两次返回时收到错误消息。如果我将它们注释掉,我不会得到错误。有什么理由不应该这样做吗?
std::ifstream bipgetConfigurationPath() {
char bipacfFilename[256], bipacfFullPath[512];
char *bipconfigPath;
char *bipdefaultConfigFile;
const char *bipdefaultConfigFileName;
bipdefaultConfigFile = "./Resources/plugins/Xsaitekpanels/D2B_config.txt";
bipdefaultConfigFileName = "D2B_config.txt";
XPLMGetNthAircraftModel(0, bipacfFilename, bipacfFullPath);
bipconfigPath = strstr(bipacfFullPath, bipacfFilename);
strncpy(bipconfigPath, bipdefaultConfigFileName, sizeof(bipacfFilename));
puts(bipacfFullPath);
// Check if ACF-specific configuration exists
std::ifstream bipcustomStream(bipacfFullPath);
if (bipcustomStream.good()) {
return bipcustomStream;
} else {
std::ifstream bipdefaultStream(bipdefaultConfigFile);
if (bipdefaultStream.good()) {
return bipdefaultStream;
}
}
}
谢谢比尔