C++ QT创建者,返回(C+;+;)
有人能解释一下为什么使用这两种类型的退货吗C++ QT创建者,返回(C+;+;),c++,qt,return,qt-creator,C++,Qt,Return,Qt Creator,有人能解释一下为什么使用这两种类型的退货吗 int parse(QTextStream& out, const QString fileName) { QDomDocument doc; QFile file(fileName); if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) { out<<"Datei "<<fileName<<" nicht lesb
int parse(QTextStream& out, const QString fileName) {
QDomDocument doc;
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
out<<"Datei "<<fileName<<" nicht lesbar"<<endl;
> return 1;
}
QString errorStr;
int errorLine;
if (!doc.setContent(&file, false, &errorStr, &errorLine)) {
out<<"Fehler in Zeile "<<errorLine<<": "<<errorStr<<endl;
> return 2;
}
...
}
int解析(QTextStream&out,常量QString文件名){
QDOM文件文档;
QFile文件(文件名);
如果(!file.open(QIODevice::ReadOnly | QIODevice::Text)){
out在第一个示例中,函数提前返回以指示错误。无法打开文件,因此函数将向该函数的调用者返回值。无法设置内容,函数将向调用者返回不同的值
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
out<<"Datei "<<fileName<<" nicht lesbar"<<endl;
return 1; // return value to caller
}
在函数main()的末尾
,返回0;
表示程序成功运行。在第一个示例中,函数提前返回以指示错误。无法打开文件,因此函数将向该函数的调用方返回值。无法设置内容,函数将向调用方返回其他值
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
out<<"Datei "<<fileName<<" nicht lesbar"<<endl;
return 1; // return value to caller
}
在函数main()的末尾
,返回0;
表示程序成功运行。在第一个示例中,函数提前返回以指示错误。无法打开文件,因此函数将向该函数的调用方返回值。无法设置内容,函数将向调用方返回其他值
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
out<<"Datei "<<fileName<<" nicht lesbar"<<endl;
return 1; // return value to caller
}
在函数main()的末尾
,返回0;
表示程序成功运行。在第一个示例中,函数提前返回以指示错误。无法打开文件,因此函数将向该函数的调用方返回值。无法设置内容,函数将向调用方返回其他值
if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) {
out<<"Datei "<<fileName<<" nicht lesbar"<<endl;
return 1; // return value to caller
}
在函数main()
的末尾,返回0;
表示程序成功运行。没有不同的“类型”属于return
。您需要return;
其中
是您想要的函数返回值。在您的代码中,函数可能返回不同的值以表示请求操作的不同结果。没有不同的“类型”属于return
。您需要return;
其中
是您想要的函数返回值。在您的代码中,函数可能返回不同的值以表示请求操作的不同结果。没有不同的“类型”属于return
。您需要return;
其中
是您想要的函数返回值。在您的代码中,函数可能返回不同的值以表示请求操作的不同结果。没有不同的“类型”您可以执行return;
其中
是您想要的函数返回值。在您的代码中,函数可能返回不同的值以表示请求操作的不同结果。