0
How to open data files
c++
3 Answers
+ 6
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
string str;
ifstream me_tryna_read_file;
me_tryna_read_file.open("file.txt");
me_tryna_read_file >> str;
me_tryna_read_file.close();
cout << str;
return 0;
}
// reads one string from dem text file.
+ 1
In c++ I think you can use #include<fstream> with key words in the code : ifstream and ofstream (to read or write in .txt or binary files
+ 1
yes you are correct c++ can write to and read from a text file. Sololearn does not go into it in great detail. go to the websites 'tutorialspoint' or 'cplusplus' for a more detailed explaination.