+ 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

25th Oct 2016, 2:31 PM
Student in Need
Student in Need - avatar
3 Antworten
+ 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.
26th Oct 2016, 10:41 AM
Nelson Urbina
Nelson Urbina - avatar
+ 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
26th Oct 2016, 5:38 PM
Nelson Urbina
Nelson Urbina - avatar
+ 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
26th Oct 2016, 2:53 PM
Student in Need
Student in Need - avatar