0

i sloved the previous problem and got the new problem now, i have three file header file where i define the function prototype and the other implementaion file for the function body and other one is the test file which takes input for the implementation file
i have a function

void search_s(srch,status);
srch and status are both input using the getline and srch is string and status is bool
so i got the compilation error stating
no matching function for call to `getline(std::istream&, bool&, char)'

so what is possible reason for it ,,
i have the header file - fucntion prototype define as
void search_s(std::string, bool& status)

3
Contributors
9
Replies
12
Views
9 Years
Discussion Span
Last Post by Narue
0

i have the include<string>
and i have the similar function search_f(srch)
and it works but when i tried to use it with the bool variable input initally declared as bool status =false; , it gives the error

0

Wait, have you defined your own getline function? Those parameters don't match the standard getline function, which means you're either calling it incorrectly (if you meant to use the standard getline), or you're using a custom getline function but forgot to define it. Without seeing your code, I can't begin to guess.

0

NO, getline syntax is below
getline(cin,stat,'\n');
cl.search_s(srch, stat);
the above getline is the error generated by the g++ compiler
the stat is defined as void search_s(string srch,bool& stat) as the fucntion prototype in the header file

0

cout << "get the search string for list";
cin.ignore(2,'\n');
getline(cin,srch,'\n');
cout << "get the new status for the list";
cin.ignore(2,'\n');
getline(cin,stat,'\n');
cl.search_s(srch, stat);
break;

0

>stat is the bool
Okay then, can you tell me how you intend to read a string into a variable of type bool?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.