我想把动态数组的内容写入文件,该怎么操作? 
数组的元素是记录型的。
写入到二进制文件。
数组是这样定义的:
type
  TMOInf = Record
    op_cd: String;
    mo_no: String;
    mo_mob_use: String;
    mo_phone: String;
    mo_content: String;
    mo_coding: Integer;
    mo_pid: Integer;
    mo_udhi: Integer;
    corp_id: String;
    mo_reserve: String;
    mo_flag: Integer;
  end;m_Queue: Array of TMOInf;
我是用TFileStream来写的,写入的不对,应该怎么写?

解决方案 »

  1.   

    type
      TMOInf = Record
        op_cd: String; //这些String是不能正常写入的,sizeof(string) = 4,这儿建议用array [0..N] of Char(固定数组)来代替string
      

  2.   

    type
      TMOInf = packed Record
        op_cd: String[10];
        mo_no: String[10];
        mo_mob_use: String[10];
        mo_phone: String[10];
        mo_content: String[10];
        mo_coding: Integer;
        mo_pid: Integer;
        mo_udhi: Integer;
        corp_id: String[10];
        mo_reserve: String[10];
        mo_flag: Integer;
      end;m_Queue: Array of TMOInf;setLength(m_Queue,10);