| okutil_read_file_section  DescriptionRead an ASCII text file that are like LabTalk OGS files with sections Syntax
int okutil_read_file_section( LPCSTR lpcszFilename, LPCSTR lpcszSecName, string * pstr, string * pstrComments, bool bWholeSection = false, bool bExposeSectionName = false )
 Parameters
    lpcszFilename[input] fullpath file namelpcszSecName[input] section name, [] not neededpstr[output] content of the sectionpstrCommentsbWholeSection[input] if true, the comments will not be separated out, but instead the whole section will be put into *pstr.bExposeSectionName[input] if true, it can find section name with pair "[]" inside Returnsize of *pstr if success, or -1 = section not found -2 = file not found ExamplesEX1 
void okutil_read_file_section_ex1()
{
    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);
}
RemarkSee Alsookutil_write_file_section, okutil_get_file_sections header to Includeorigin.h Reference |