Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/158.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 错误:不合格的ID_C++ - Fatal编程技术网

C++ 错误:不合格的ID

C++ 错误:不合格的ID,c++,C++,我正试图将二进制数据写入一个文件流out,我已将其作为std::ios::binary打开。我正试图使用ostream::write对其进行写入 int S = 0; int space = htobe32(-120); for (int g = 0; g < Z; ++g) { for (int h = 0; h < Y; ++h) { for (int i = 0; i <

我正试图将二进制数据写入一个文件流
out
,我已将其作为
std::ios::binary
打开。我正试图使用
ostream::write
对其进行写入

int S = 0;
int space = htobe32(-120);

for (int g = 0; g < Z; ++g) 
        {
            for (int h = 0; h < Y; ++h) 
            {
                for (int i = 0; i < X; ++i)
                {
                    if (data_array[g][h][i] != 0)
                    {
                        S=htobe32(data_array[g][h][i]);
                        out.write(&S, std::sizeof(S));
                    }
                    else
                    {                
                        out.write(&space, std::sizeof(space));
                    }
                }                  
            }
         }
ints=0;
int space=htobe32(-120);
对于(int g=0;g
现在我得到了
错误:在我试图写出的两个地方,在'sizeof'之前都应该有不合格的id。

sizeof()
是一个语言运算符,不是标准库的一部分,所以不能在它前面加上
std

 sizeof(anything)
sizeof()
是一个语言运算符,不是标准库的一部分,因此不能在其前面加上
std

 sizeof(anything)

它是纯
sizeof
,无
std:
。它是纯
sizeof
,无
std: