C++ 逗号运算符的左操作数是引用,而不是调用
创建一个套接字程序,我在这里得到一些警告。不确定问题可能是什么:C++ 逗号运算符的左操作数是引用,而不是调用,c++,C++,创建一个套接字程序,我在这里得到一些警告。不确定问题可能是什么: if (recv, clientWantsFile, MAX_PATH, 0) { ifstream file (clientWantsFile); if (file.is_open()) { send(Sub, "yes", MAX_PATH, 0); } else { send(Sub, "no", MAX_PATH, 0
if (recv, clientWantsFile, MAX_PATH, 0) {
ifstream file (clientWantsFile);
if (file.is_open()) {
send(Sub, "yes", MAX_PATH, 0);
} else {
send(Sub, "no", MAX_PATH, 0);
}
// Gets the size of the file requested
fileSize = file.tellg();
}
警告:
warning: left operand of comma operator is a reference, not call, to function 'recv' [-Waddress]
warning: left operand of comma operator has no effect [-Wunused-value]
warning: right operand of comma operator has no effect [-Wunused-value]
有什么可能出错的线索吗?编译器的意思是你可能想要
if(recv(clientWantsFile,MAX_PATH,0)){
。哦,我明白了。谢谢!编译器的意思是你可能想要if(recv(clientWantsFile,MAX_PATH,0)){
。哦,我明白了。谢谢!