我需要从文件中读取完整的32位。我在STL中使用ifstream。我能不能直接说:我需要定义“>>”运算符来使用cin用Int32的吗?
int32 my_int;
std::ifstream my_stream;
my_stream.open("my_file.txt",std::ifstream::in);
if (my_stream && !my_stream.eof())
my_stream >> my_int;
......或者我需要以某种方式覆盖>>运算符INT32工作?我没有看到INT32这里列出: http://www.cplusplus.com/reference/iostream/istream/operator%3E%3E/
是的,但不是很大的endian几乎死亡或死亡?我还没有看到年龄的solaris系统... – 2010-09-02 22:43:15
@Jason:ARM不会死亡或死亡:)此外,大多数文件格式和网络协议被指定为大端(由于某种原因)。 – 2010-09-03 00:06:59
哦,忘了ARM是大端endian。卫生署!好东西,我的代码不会在任何智能手机上使用; o) – 2010-09-03 20:13:32