I'm trying to make a simple script to split a delimited string, by checking each char in the input; if it is a '/' move to the next string in the array, if it is a char add to the string in the array.
My problem here is that about halfway through the for loop, my 'delimit_count' is decrementing? So it isn't catching when there are too many '/'s in the input string, and also appends to the wrong string in the array.
I'm very new to c++, just wondering why this would be? While debugging, 'delimit_count' seems to decrease by one, only occasionally, at this line:
str_result is an array of size 2. You have to make it size 3 if you want to store 3 strings.
input_pos<=str_input.length()
should probably be input_pos<str_input.length()
otherwise you will append a null character '\0' at the end of the last string, which you probably don't want to do.