substr()

Im trying to use the substr() function but I constantly get this error saying substr undeclared identifier although I have included the string file.
<sarcasm>I love it when we're left to guess how you're calling the function.</sarcasm>
The fact that I know what the problem is without looking at your code is evidence of my awesomeness.

Ehem. Anyway.
substr() is not a static method, so it needs to be called from an std::string:
1
2
std::string str;
str.substr(/*blah blah blah*/);
Here's how I'm calling it :P


char *prefix;
prefix = new char[];
int count= 0;
char temp;

cout<<endl<<"Prefix Expression : ";

fstream File("Prefix.txt", ios::in);


while(File>>input)
{
prefix[count] = input;
count ++;
cout<<input;
}
File.clear(); // reset eof for next input
File.seekg( 0 );
cout<<endl;

substr(prefix, 1, count-1, temp);
Topic archived. No new replies allowed.