====== C - C++ Files - File read ====== #include #include using namespace std; int main() { char ch; int i; float f; char str[80]; ofstream out("test.txt"); if(!out) { cout << "Cannot open file.\n"; return 1; } out << 10 << " " << 123.23 << "\n"; out << "This is a text."; out.close(); ifstream in("test.txt"); if(!in) { cout << "Cannot open file.\n"; return 1; } in >> i; in >> f; in >> ch; in >> str; cout << i << " " << f << " " << ch << "\n"; cout << str; in.close(); return 0; }