First use the code tags provided. When you hit reply there are reply guidelines to the right which provides the description of how to use them. Second could we see what your input file looks like (just a few lines will do), or how the assignment describes what the input file should be like. Third "It doesn't work" isn't a very good description of the problem. Does it not compile? Does the program crash? Does your vector contain 0 items? Here is a couple of items i see.
In the input file is it mailto:<EmailAddyHere> or mailto: <EmailAddyHere> (notice the space).
-
if(sub[index] == "") // does that even compile? you are checking for a char so
-
if(sub[index] == ' '); use single quotes when checking chars
-
if you have mailto: <emailaddy> you will exit the loop without copying the string items because you have a space between mailto: and the e-mail address.