Here are some other helpful things in case you need them:
Code:int last_position = stringname.rfind("\"); int length_of_path = stringname.length() - (last_position + 1); string path = stringname.substr(last_position + 1, length_of_path);
Here are some other helpful things in case you need them:
Code:int last_position = stringname.rfind("\"); int length_of_path = stringname.length() - (last_position + 1); string path = stringname.substr(last_position + 1, length_of_path);
\ is one of those special characters you need to use an escape sequence for, i.e. use \\ instead of just \.
Or just simply:Originally Posted by quizkiwi
Code:string path = stringname.substr(stringname.rfind("\\")+1);
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
ok thank you that was very helpful, one question though im use
char [] to store my getline, because getline wouldnt accept string
variables, i shoudl have thought of using string, because i
was aware of those commands, however what im nto aware of
is the best way to read into a string, if i remember correctly,
read() will do it, but it reads so many characters and since im not
sure of each lines lenght at run time, it may read to far or to short.
with that said my question would be, can read() take a delimiter
or is there a better way.