Hi, I want to change words from a readed text file. To be more precisely, I need to change the date type in a text file to their representing digits.

Example
2002 y. June mon. 1 d. is the given text.
02-06-01 is the output.

So, any thoughts for getting me going would be appreciated.

Recommended Answers

All 2 Replies

1. create an ifstream object for file reading
2. Attempt to open the file
3. Perform error checking to see if file opened
4. If open successful, read file into a data structure of your choice (string seems to be popular)
5. close the ifstream object
6. Alter the data as you wish
7. create an ofstream object for file writing
8. open the file using the ios::trunc flag which will clear the file
9. write the newly altered data to file
10. close your ofstream object.

@Snippset: You can check the Qt library which has a QDate class that includes this type of conversion as well as other stuff, or, do you want to implement this functionality yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.