I am having trouble getting my program to check a string for more than one file extension.
The following code:
void Check_ext(const string& filename)
{
int i = filename.find(".jpg");
while(i == string::npos)
{
cout<<"Invalid input: must end with '.jpg', '.jpeg', or '.gif'"<<endl;
cin.clear();
cin.ignore(1000,'\n');
cin>>filename;
i = filename.find(".jpg");
}
}
Works fine if all I need is to check for the '.jpg' file extension, but I need to check for multiple file extensions(like .gif,etc.). How would I go about doing that?