Thanks for the replies.
I have tried PanGalactic's method, but it doesn't work. I get segmentation fault.
Kempofighter:
With regards the the codes,
locate -> will get the position where "N" of "Name : " is,
value_id_start = locate + 7 -> adding 7 becomes the position of " ", the last character from "Name : " is.
then
end_location = line.find(" ", value_id_start) -> the find will to find a blank space " ", starting from position of end_location, which for example:
1 2 3 4 5 6
|
Name : John
if location of 'N' is 1 for example, and location of the last character 'n' of John is 11.
end_location=line.find(" ", value_id_start) mean will find the " " starting from position 7.
so the first " " that it find starting from position 7 is position 12, which is after 'John'
|
and if i get the end_location minus the value_id_start, i get the length of the word "John"
then if i do "line.substr(value_id_start, val_length), i get the word John.
I have tried this is other types of string where it has a whole line of word and i extract values between the words and it works.
problem now is the end_location to find " " will go all the way to the next line since the character after the word "John" is not " " but instead is a 'carriage return' which will go to the next line.
Sorry for my bad explanation, I hope you would understand what i mean.
Thanks again