ID:189824
 
I'm having trouble when I try to compile this C++ code:

#include

#include

int main()

{

char type[100];

cout<<"Welcome to Word Processor!"<<endl;

cout<<"Please type some text:"<<endl;

ofstream create_text("new1.txt");

create_text<<cin.getline(type, 100, '\n');

create_text.close();

ifstream read_text("new1.txt");

read_text<<cin.getline(type, 100, '\n');

cout<<cin.getline(type, 100, '\n');

read_text.close();

return 0;

}

I'm getting these errors:

C:\C ++\Microsoft Visual\MSDev98\MyProjects\Word Proccesor\Word Proccesor.cpp(23) : error C2676: binary '<<' : 'class ifstream' does not define this operator or a conversion to a type acceptable to the predefined operator

And It's On This Line:

read_text<<cin.getline(type, 100, '\n');

Thanx,
Punkrock546
you're using an ifstream(input file stream), if you want to write to it..use an ofstream(output file stream)...
In response to Destroy
Thanx a Bunch!

Punkrock546