Read the id-value pair from file
bool tree_read_values_with_ids( LPCSTR lpcszFilename, vector<int> & vnIDs, vector<string> & vsValues, string & strComment = NULL )
true if succeed
EX1
void tree_read_values_with_ids_ex1() { string strCreateFile = okutil_get_origin_path(USER_FOLDER) +"temp.ini"; if( !strCreateFile.IsFile() ) { out_str("can't open the file!please check it"); return ; } vector<int> vnIDs = {1, 2}; vector<string> vsValues = {"1.1", "2.2"}; vector<string> vsLabels = {"L1", "L2"}; vector<int> vnIDtemp; vector<string> vsVtemp; if( tree_save_values_with_ids( strCreateFile, vnIDs, vsValues, vsLabels) ) { if( tree_read_values_with_ids( strCreateFile, vnIDtemp, vsVtemp) ) out_str("read successfully!"); else out_str("read failure"); } else out_str("save failure"); }
origin.h