streamsize、streamoff 和其他与流相关的数据类型的实际类型是什么
what is the actual type of streamsize,streamoff and other stream related data type
当我想找出 streamsize 的实际数据类型时,cpp 参考资料说
Type to represent sizes and character counts in streams.
It is a typedef of one the fundamental signed integral types.
It is convertible to/from streamoff.
看得我一头雾水,其他类型如streamoff,streampos,fpos的解释也差不多
术语"integral types"表示他们是"some integer type",但不一定是int
。 signed
表示它们可以是正面的也可以是负面的。大小有符号值的原因是 streamoff
和类型,在文件中可以是正向(正向)也可以是反向(负向)——当你想重新读取文件中的内容时,你求相对于当前位置的负偏移量。
当然,size本身不会是负数。
整数类型意味着它们可以是 int、unsigned int、long、unsigned long 等 on.It 取决于您的机器和 compiler.For 例如,在我的 machine:win7 64、vs2013 win32 中Debug.The
的输出
cout << sizeof(streamsize) << endl;
cout << sizeof(streamoff) << endl;
是8,8.In其他环境,可能不一样。
当我想找出 streamsize 的实际数据类型时,cpp 参考资料说
Type to represent sizes and character counts in streams.
It is a typedef of one the fundamental signed integral types.
It is convertible to/from streamoff.
看得我一头雾水,其他类型如streamoff,streampos,fpos的解释也差不多
术语"integral types"表示他们是"some integer type",但不一定是int
。 signed
表示它们可以是正面的也可以是负面的。大小有符号值的原因是 streamoff
和类型,在文件中可以是正向(正向)也可以是反向(负向)——当你想重新读取文件中的内容时,你求相对于当前位置的负偏移量。
当然,size本身不会是负数。
整数类型意味着它们可以是 int、unsigned int、long、unsigned long 等 on.It 取决于您的机器和 compiler.For 例如,在我的 machine:win7 64、vs2013 win32 中Debug.The
的输出
cout << sizeof(streamsize) << endl;
cout << sizeof(streamoff) << endl;
是8,8.In其他环境,可能不一样。