Saving and Recovering a file named by an user-entered parameter

I'm currently using C++. Need help in the following,

1. How can I save a text file using a parameter which the user entered?

For example, the user enters the word "Johnny". The program will create a new text file "johnny.txt"


2. How do I search the directory for a text file after the user entered a keyword?

For example, the user enters the word "johnny". The program will search the directory and recover the text document "johnny.txt".
1. Use cout (http://www.cplusplus.com/reference/iostream/) to get user input.
Use fstream (http://www.cplusplus.com/reference/fstream/) to read a text file.

You'll find some examples there.

2. Use scandir(). Have a look for it in man section 3.
Topic archived. No new replies allowed.