You can pass a string object to strcmp like that. You have to pass it a character array instead.: strcmp(s.c_str(), "quit"); For that matter, though, you can just do this: while ( s == "quit" ) unless you're trying to loop until s is quit, in which case you're logic is wrong with strcmp, too. while ( s != "quit" ) Thanks, Lyle -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of learning c++ Sent: Wednesday, September 01, 2004 8:17 AM To: gcc-help@xxxxxxxxxxx Subject: for argument `1' to `int strcmp(const char*, const char*) Hi, I hope to use the build in function ""strcmp()" in C++, but I can not deal with it. My code is like this: #include <iostream> #include <string> #include <cstring> #include <vector> using namespace std; int main(){ vector<string> v1; vector<string>::iterator iter; string s; do{ cout <<"please input something:" <<endl; cin>>s; v1.push_back(s); }while (!(strcmp(s,"quit"))); for(iter=v1.begin(); iter!=v1.end();iter++) cout <<*iter<<endl; return 0; } error: cannot convert `__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >' to `const char*' for argument `1' to `int strcmp(const char*, const char*)' I know now "s" is an object of string. How can I compare it with a string, like ""quit"? Are there some methods in String class? Thanks, _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail