读取结构化二进制.dat文件

时间:2015-12-25 07:58:28

标签: file-read

我无法读取具有以下结构的二进制.dat文件:

typedef struct {
    unsigned char message_code;
    unsigned char code;
    unsigned char sequence;
    unsigned char reserve_1;
    float ladle_weight;
    float tundish_weight;
    unsigned char reserve_2;
    unsigned char no_of_measurements;
    unsigned int  measurement_1;
    unsigned int  measurement_2;
    unsigned int  measurement_3;
    unsigned int  measurement_4;
    unsigned int  measurement_5;
    unsigned int  measurement_6;
    unsigned int  measurement_7;
    unsigned int  measurement_8;
    } message_metal;

 typedef struct {
    unsigned char message_code;
    unsigned char strand_no;
    unsigned char steel_code;
    unsigned char container_state;
    float water_pr_at_mould;
    float water_con_at_mould;
    float temp_diff_of_water_at_mould;
    float water_pr_at_common_intake;
    float water_con_at_section_1;
    float water_con_at_section_2;
    float water_con_at_section_3;
    float water_con_at_section_4;
    float water_con_at_section_5;
    float water_pr_at_section_1;
    float water_pr_at_section_2;
    float water_pr_at_section_3;
    float water_pr_at_section_4;
    float water_pr_at_section_5;
    float withdrawl_speed;
    float metal_level_in_mould;
    float bloom_length;
    } message_strand;

typedef struct {
     message_metal metal;
     message_strand strand[4];
     unsigned char hour;
     unsigned char min;
     unsigned char sec;
} machine;

无法附加.dat文件。

0 个答案:

没有答案