C++中引用
通过局部函数对全局变量赋值或者更改其值,通过引用方式。记在函数的参量前加&,其他规格不变。例如
void GetPathParameter(int &Model_No, std::string ClimVari, std::string Scenario, int * &op, std::string * &ModelName, std::string *&ModelPathProfix, std::string * &ModelFileName, std::string * &ModelMidPath, std::string * &MoldelFilePrefix, std::string * &ModelFileSuffix)
{
//std::string sqlModel = "select ClimVari,Scenario, Model,ModelPathProfix,FileFolderNames,MidPath,FilePrefix,FileSuffix from ModelsAndFolders where ClimVari='pcp' and Scenario='his' order by Model";
std::string sqlModel = "select ClimVari,Scenario, Model,ModelPathProfix,FileFolderNames,MidPath,FilePrefix,FileSuffix from ModelsAndFolders where ClimVari='" + ClimVari + "' and Scenario='" + Scenario + "' order by Model";
......
}