我有这个代码块:
int myFunc( std::string &value )
{
char buffer[fileSize];
....
buffer[bytesRead] = NULL;
value = buffer;
return 0;
}
行 - buffer[bytes] = NULL 给我一个警告:从 NULL 转换为非指针类型"char"。如何摆脱此警告?
不使用NULL
?它通常是为指针保留的,你没有指针,只有一个简单的char
。只需使用