beginner - can't output multiple words with string
Feb 20, 2013 at 4:27pm
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
Feb 20, 2013 at 4:30pm
Topic archived. No new replies allowed.