|
SOLUTIONS
|
MATHEMATICA 内置符号
BinaryRead
BinaryRead[stream]
从一个输入数据流中读取原始二进制数据的一个字节,返回一个0到255之间的整数.
BinaryRead[stream, type]
读取一个指定类型的对象.
BinaryRead[stream, {type1, type2, ...}]
读取一个指定类型的对象序列.
更多信息更多信息
- 可能读取的类型为:
-
"Byte" 8 位无符号整数 "Character8" 8 位字符 "Character16" 16 位字符 "Complex64" IEEE 单字长精度复数 "Complex128" IEEE 双倍字长精度复数 "Complex256" IEEE 四倍字长精度复数 "Integer8" 8 位带符号整数 "Integer16" 16 位带符号整数 "Integer24" 24 位带符号整数 "Integer32" 32 位带符号整数 "Integer64" 64 位带符号整数 "Integer128" 128 位带符号整数 "Real32" IEEE 单字长精度实数 "Real64" IEEE 双倍字长精度实数 "Real128" IEEE 四倍字长精度实数 "TerminatedString" 零终止的 8 位字符串 "UnsignedInteger8" 8 位无符号整数 "UnsignedInteger16" 16 位无符号整数 "UnsignedInteger24" 24 位无符号整数 "UnsignedInteger32" 32 位无符号整数 "UnsignedInteger64" 64 位无符号整数 "UnsignedInteger128" 128 位无符号整数 - 如果只有一个带有指定名称的开放输入数据流,则赋予 BinaryRead 的第一个自变量可以是 InputStream["name", n],或者直接是
. - 你可以利用 OpenRead 打开一个文件或管道,以获得一个 InputStream 对象.
- 随 BinaryRead 使用的数据流应该随 BinaryFormat->True 打开.
- 对于任意数据流而言总会保持一个"当前点". 当你从一个数据流中读取一个对象时,该当前点留在你读取的输入后面. 因此可以连续调用 BinaryRead 以便在文件一类的数据流中读取连续对象.
- 如果在该文件末尾,BinaryRead 返回 EndOfFile.
- IEEE "无穷大" 时 BinaryRead 返回 Infinity;IEEE "非数值" 时返回 Indeterminate.
- 可以使用以下可选项:
-
ByteOrdering $ByteOrdering 使用的字节排序方式 Path $Path 搜索打开文件的路径
版本 5.1 的新功能 | 版本 6 修改功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
