Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

getline() not taking delimiter argument (ERROR: no instane of overloaded function "getline" matches argument list

been getting this error everytime i’ve tried to use getline with a delimiter. Please help!

vector<string> readRecordFromFile(string file_name, string search_term)
{
    vector<string> record;
    ifstream file;
    file.open(file_name);

    bool found_record = false;

    string field_one;
    string field_two;
    string field_three;

    while (getline(file, field_one, ",") && !found_record)
    {

    }
}

getline works if the third argument is removed, but i need to use a delim

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just replace getline(file, field_one, ",") with getline(file, field_one, ',') because the third argument should be a char and not a string literal.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading