BCS Load Text File Into wxArrayString


Sometimes a function is needed to load the contents of a text file into a wxArrayString.  The following code snippet accomplishes the desired task.

[codesyntax lang=”cpp”]

void srcColFrame::loadSC(string fs, wxArrayString sc, int ix)
{
    ifstream ips;
    ips.open(fs);
    string line;
    while (getline (ips, line))
    {
        fsp[ix].coll.Add(line);
        //sc.Add(line);
    }

}

[/codesyntax]

The input file is processed line by line while simultaneously adding the line to the associated collection.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *