Can't convert string to char**

OK, I think you guys are all busy so I'll just put the code line which has error and I think you Masters of dark secrets of C++ will know this one.
This is the line:
while(getline(tekst, temp, '\n')){
and this is the error text:
cannot convert ‘std::string’ to ‘char**’ for argument ‘1’ to ‘__ssize_t

Obviously, I see it says that I can't convert string to char** but I don't understand because both variables were defined as string variables.
What is char** anyway???
Please help me to understand this so I can continue on my path of learning.
I think the first argument to getline (in your case tekst) should be of type istream or some other derived class. I think istream can be cast into char** but not std::string hence the error. Maybe you want tekst to be istringstream instead.
Oh, thank you messenjah! Just to be sure, I don't want to convert my string variable to char**! I'm just receiving this error and all I'm doing is reading with getline() function from a string variable to another string variable.
Here's the line with defining those two variables:
std::string tekst = t, temp, tekst2 = "";
As messenjah said, the first argument of getline should be an object of a class derived from istream, you are passing tekst which is a string

follow messenjah suggestion of using stringstreams
eg:
1
2
3
4
istringstream ss ( tekst );
while(getline(ss, temp, '\n')){
     //etc
}


As the first argument to getline, tekst needs to be an object of class istream or a derived type. I think what you want is to do
std::istringstream tekst(t);
instead of
std::string tekst = t;
This basically creates an object of type istringstream which inherits from istream and can therefore be passed as the first argument of getline. You need to #include <sstream> if you haven't already done so.
Thanks to both of you!
Topic archived. No new replies allowed.