okutil_get_file_sections

 

Description

Get all sections name of the file

Syntax

int okutil_get_file_sections( LPCSTR lpcszFilename, StringArray * pvsSectionNames )

Parameters

lpcszFilename
[input] fullpath file name
pvsSectionNames
[output] all sections name

Return

the number of sections

Examples

EX1

void Okutil_get_file_sections()
{
    string strFile = "C:\junk.txt";
    // Write a section with comments into file,
    int nn = okutil_write_file_section(strFile,"SQL","select * from files","select any from file");
    
    nn = okutil_write_file_section(strFile,"MySQL","select name from files","select name from file");
    
    string strSec, strComments;
    okutil_read_file_section(strFile, "SQL", &strSec, &strComments);
    
    vector<string> vsSecNames;
    okutil_get_file_sections(strFile, &vsSecNames);
}

Remark

See Also

okutil_write_file_section, okutil_read_file_section

header to Include

origin.h

Reference