Thread: New to C++
View Single Post
Old 10-27-2005, 04:05 PM   #14 (permalink)
Deliverance
C++ Beginner
 
Join Date: Jul 2005
Location: Ottawa
Posts: 73
Deliverance is on a distinguished road
How do I use the c_str() to convert my strings to an array? I can't seem to figure that out, so right now i'm going to try to index the string as is.

So far I'm trying something like this in the remove_str function, but I can't seem to quite grasp it. Am I headed in the right direction with this? If not, give me a suggestion and I'll try it out from there. Thanks

Code:
int remove_string(char* in_str, string remove_str)
{
    for (int i = 0; i != (in_str.length()); i++)
    {
  	 if (strcmp(in_str[i],remove_str[i]);
  	    in_str.erase(i,sizeof(remove_str));
       }
       cout << "new in_str is: " << in_str << endl;
           

	return 0;
}
Deliverance is offline   Reply With Quote