beginner - can't output multiple words with string

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;

int main (){
    string text0, text1;
    ofstream asd;
    cout << "file name: ";
    cin >> text0;
    asd.open(text0.c_str());
    cout << "write on file: ";
    cin >> text1;
    asd << text1.c_str();
    asd.close();
    system("pause");
    return 0;
}

If i use char i can create text with multiple words but with string it stops at the first " ". Anyone can explain me why? thanks
Topic archived. No new replies allowed.