If it's a C string you can use the functions in <cstring>.
Code:#include <iostream> #include <cstring> using namespace std; int main() { char *URL = "http://www.host.com/pic01.jpg"; char *file_name; file_name = strrchr( URL, '/' ) + 1; cout<< file_name <<endl; return 0; }