How can I input or output in a .txt file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I input or output in a .txt file?

14th Jun 2016, 9:40 AM
Charliys Que
Charliys Que - avatar
2 Answers
+ 2
#include <fstream> //for both writing and reading create objects of that class ofstream or ifstream then use them with exertion or insertion operators
14th Jun 2016, 9:49 AM
Sardor
Sardor - avatar
0
as example ifstream fd ("name.txt"); fd >> a >> b; and dont forget to close at the end cause sometimes it can mess up fd.close();
15th Jul 2016, 6:57 PM
Aleksandras Salnik
Aleksandras  Salnik - avatar