-
cutting a string
I have two questions:
1:
So I have a char
http://192.168.1.1:80/path1/path2/pathn/test.exe
I want to cut this char into 3 parts, into the ip 192.168.1.1, the port 80 and the path with the file name path1/path2/pathn/test.exe.
2:
I have a char with a path c:\test\temp\test.txt and I want only the path c:\test\temp
Thanks for help.
-
If it were C, I'd say (1) sscanf, (2) strrchr. They'll both be available in C++, of course, but someone will now come along and mention something else.
-
1. If you used strings, like you should, you would have an easier time since you have a bunch of find functions and a substr function.
2. Again, use strings, and for this particular problem, use find_last_of()