next the only parts of the string vector I accessed were
option.at(0) and if option.at(0) meets certain requirements and the total vector size is equal to 2 I'd access option.at(1) also I tried to check the compatibility of each character with this function.
1 2 3 4 5 6 7 8 9
bool CheckStringCompatibility(string str,int(__cdecl *strfunc)(int))
{
for(int i = 0;i < str.size();i++)
{
if (!strfunc(str.at(i)))
return 0;
}
return 1;
}
I'm using the code in a console to separate a string from input like separating health me 100 into the separate string "health","me","100" but when I don't enter anything and press enter twice it crashes.
To try and diagnose what's going on I've stripped out the intervening functions in your program and looked at the code step by step - you getline() cin into string inputString, sstringstream inputString into class object ss and essentially push_back vector<string> vstring with the strings via istream iterator adapters as they are read off ss. I've also asked the program to output vstring.size() and print vector elements with an identifier (here *) b/w them to double-check:
Now when I press enter twice in my simple program above the output is as follows:
1 2 3 4 5 6
Enter string:
Vector size: 0
Process returned 0 (0x0) execution time : 1.610 s
Press any key to continue.
Since there was no other code in my program and the way it's set up my main() returned but I suspect returning a zero sized vector is messing up some other part of your program that you've not posted. The way to preclude this is to have the input validation as part of the Input() function in the first instance and not within main()