C一次读取4个字节

时间:2015-09-14 04:00:49

标签: c byte

我有一个二进制文件,格式如下:每个字长4个字节:

## determine which rows match the specified condition
w <- with(df, Company == "ACoy" & Date > "2015-08-30")
## replace only those 'w' values with the specified calculation
df$Number <- replace(df$Number, w, df$Number[w] / 3)
## result
df
#    Company       Date Number
# 1     ACoy 2015-08-28   1000
# 2     ACoy 2015-08-29   1300
# 3     ACoy 2015-08-30   1500
# 4     BCoy 2015-08-30   3000
# 5     CCoy 2015-08-30   2000
# 6     CCoy 2015-08-31   3000
# 7     ACoy 2015-08-31    500
# 8     BCoy 2015-08-31   3000
# 9     CCoy 2015-09-01   3500
# 10    CCoy 2015-09-02   1000
# 11    ACoy 2015-09-02    300
# 12    CCoy 2015-09-03   2000
# 13    BCoy 2015-08-31   3000
# 14    CCoy 2015-08-31   3000

我很难找到一种方法来读取文件的方式,前4个字节是操作码,接下来的8到16个字节代表每行的下3个字。下面是我目前尚未开始工作的代码。

add arg1 arg2 arg3 // where in this example it would store the value of arg1+arg2 in arg3

我不确定如何一次获得4个字节然后评估它们。有人可以给我一些帮助吗?

0 个答案:

没有答案
相关问题