i was trying to open a file uing ifstream and storing it as char str
I was told to use get, but it doesnt work
The File has multiple lines
like
Here is my code, could someone tell me whats wrong and how to use get()Code:hi
hello
hi
Code:#include <iostream.h>
#include <fstream.h>
int main()
{
char str[300];
ofstream c_file;
c_file.open("text.txt");
c_file<<"Hi\n\tHello\nHi";
c_file.close();
ifstream a_file("text.txt");
a_file.get(str,300, '\n');
cout<<a_file.get()<<endl;
a_file.close();
return 0;
}