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

monkeyape1234

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

Anoop Rana

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why am I having trouble with getline()? "No instance of overloaded functions matches the argument list" and "data is ambiguous"

No instance of overloaded function matches the argument list

no instance of overloaded function "std::make_unique" matches the argument list, but works with unique_ptr constructor

C++ more than one instance of overloaded function matches the argument list when creating a header file

No instance of overloaded function winrt::Windows::UI::Xaml::Controls::Primitives::SelectorItem::Content matches the argument list

c++ template - More than one instance of overloaded function matches the argument list

C++ and SFML, no instance of the overloaded function "sf::RenderWindow.draw()" matches the argument list

More than one instance of overloaded function matches the argument list and I can't find where the error happens

c++ struct in map as value - error "no instance of overloaded function matches the argument list"

c++ getline() error, no instance of overload function "getline" matches the argument list

Error with getline

Using GetLine with ifstream - no instance of "getline" matches the argument list

C++ Getline issues (No instance of overloaded function "getline"

No instance of overloaded function for getline

taking argument in to another function

CUDA template error: no instance of function template matches the argument list

Segmentation error with getline() function?

How to fix "no instance of overloaded function "getline" matches the argument list" when using getline with an int

Error No instance of overloaded function "getline" matches the argument list

Is there a way to "discard" the output argument of std::getline()?

no instance of "getline" matches the argument list

lambda function doesn't matches argument list

ambiguity of overloaded function taking constant Eigen argument

Error passing Eigen matrix to a function in C++: "no instance of overloaded function matches the argument list"

C getline() function: return value vs second argument

No instance of overloaded function "std::vector<_Ty, _Alloc>::erase [with _Ty=Enemy *, _Alloc=std::allocator<Enemy *>]" matches the argument list

C++ No instance of overloaded function matches the argument list when calling std::replace()

no instance of overloaded function "std::make_unique" matches the argument list

Overloaded Function as Argument to Templated Function