I'm working in windows forms and am a bit lost with reading a string.
I have a text file which is read into a string:
String ^ TextString = this->textBox1->Text;
Now I want to read this string one number at a time. It should be filled with an undefined amount of integers. I want to select each input at a time, seperated by either a space or comma and
a) check whether it is an integer or not
b) if it is an int then do some stuff to it via sending it off to function store: store( x );
1. Is it possible to do this all in visual c++ or do i need to convert to std string? (I dont really want to mix in the same file)
2. If I have to use std, is this right? :
String ^ TextString = this->textBox1->Text;
int_separator<int> sep(", "); tokenizer< int_separator<int> > tokens(TextString, sep); BOOST_FOREACH (const string& num, tokens) {
store( num );
}
Do you see a 'cleaner' way, without mixing standard c++ with visual? I'd very much appreciate to hear your thoughts. Thank you for reading, and for any responses.