+ 1
How can I store words and numbers in a .txt file and then retrieve them for later use?
please explain, cause I'm struggling right now :( Thanks in adv
3 Réponses
+ 4
You have to import the fstream library in your code and use its methods. The last two lessons in module 9 of the C++ tutorial explains this topic and how to use the library to write data to a file. I suggest that you give it a look and if you still have doubts, we will be here to help.
+ 4
Please, put your code in Code Playgroung and share the link or post the code here in order to take a look. In the meantime, check that you open/close the file before/after you perform any writing/reading action. Also check that you open the file in the correct mode (write mode for writing and read mode for reading).
Hope it help
+ 1
I already gave it a try and it is already writing the words I enter into a text, but sadly I cannot retrieve them. I tried using fscanf() but everytime i ran my program it won't respond anymore. Any ideas on how I could fix this? Thanks, btw