If you just want to find a space, use find with " " (note the space inside the quotes). If you want to find any space, tab or newline, use find_first_of with " \t\n", which will find any of those three characters. Since you are using getline, there won't be any '\n' characters, but you can find spaces or tabs with that method anyway.