参数配置中有3个结构体,加起来有30个左右需要配置的参数,用什么方法把这些参数存入配置文件,再读取出来 。。
本来想用INIFILE但参数太多,实现起来觉得代码写的太多了,有没有更好一些的方法。。

解决方案 »

  1.   

    写一个结构体到TStrings的转换和TStrings到结构体的转换函数.就麻烦一次,修改起来也方便.
      

  2.   

    将INI文件转为ADOQuery特定的XML文件,装载与修改都比较简便
      

  3.   

    option_s=record                                        
        IF_Frequency:double;        
        Sampling_Frequency:double;  
       CN0:double;                
        Filter_BandWidth:double;   
        Quantization_Bit:integer;   
        IQ_Switch:integer;          
        Iono_Switch:integer;
        Tropo_Switch:integer;       
         SatClkErr_Switch:integer;
        RxClkErr_Switch:integer;
        SatObitErr_Switch:integer;
        Multipath_Switch:integer;   
        Traj_filename:array [0..99] of char ;     
        Eph_filename:array [0..99] of char;      
        Output_filename_I:array [0..99] of char;
        Output_filename_Q:array [0..99] of char;
        temperature:double;                      
        pressure:double;                          
        relativehumidity:double;                 
        alpha:array [0..3] of double ;
        beta:array [0..3] of double;
        start_time:double;                 
        init_pos:array [0..2] of double;  
        init_v:array [0..2] of double;    
      end;  option_h=record                                        
        flag:char;
        start_time:double;
        x:double;
        y:double;
        z:double;
        x_vel:double;
        y_vel:double;
        z_vel:double;
        test:double;
      end;
    traject=record
       path_flag:char;
       time_lengh:double;
       acc_e:double;
       acc_n:double;
       acc_u:double;
       path_direction:char;
       radius:double;
    end;
      

  4.   

    XML可以把你的结构简化吧..复杂结构用XML比INI好多..
      

  5.   

    你结构体是够大但这样的数据结构存起来后如果不需要人类手工来改动的话直接存成二进制文件就简单多了,文件名由你定,读出来则用ft.Readvar
      ft: TFileStream;
    begin  ft := TFileStream.Create(....);  ft.Write(@rec,sizeof(option_s));  ft.Free;end;