nautilus7791
New member
שאלה ב c++
בתוכנית הבאה יש כתיבה לקובץ באמצעות אופרטור >>.כיצד אני קורא בחזרה נתונים מהקובץ?
בתוכנית הבאה יש כתיבה לקובץ באמצעות אופרטור >>.כיצד אני קורא בחזרה נתונים מהקובץ?
// redirecting cout's output #include <iostream> #include <fstream> using namespace std; int main () { streambuf *psbuf; ofstream filestr; filestr.open ("test.txt"); psbuf = filestr.rdbuf(); cout.rdbuf(psbuf); cout << "This is written to the file"; filestr.close(); return 0; }