2.1.26.65 tree_save_values_with_ids


Description

Save the id-value pair into file

Syntax

bool tree_save_values_with_ids( LPCSTR lpcszFilename, const vector<int> vnIDs, const vector<string> & vsValues, const vector<string> & vsLabels, LPCSTR lpcszTreeNodeComment = NULL )

Parameters

lpcszFilename
[input] full file name to store data pairs
vnIDs
[input]vector of IDs.
vsValues
[input] vector of string values, must be the same size of vnIDs.
vsLabels
[input] vector of string labels, must be the same size of vnIDs.
lpcszTreeNodeComment
[input] If not null, mean need save this string as comment and save to file.

Return

true if succeed

Examples

EX1

void tree_save_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"};
	if( tree_save_values_with_ids( strCreateFile, vnIDs, vsValues, vsLabels) )
		out_str("read successfully!");
	else
		out_str("save failure");
}

Remark

See Also

Header to Include

origin.h

Reference