file handling
Pleas guide me about file handling.......
1 2 3 4 5 6
|
#include <fstream>
// write data
std::ofstream output("test.txt");
out << "Number: " << 23 << '\n';
|
1 2 3 4 5 6 7
|
// read data
std::string text;
int num;
std::ifstream input("test.txt");
input >> text >> num;
std::cout << text << ' ' << num; // output: Number: 23
|
Last edited on
Topic archived. No new replies allowed.