File Names as Input
A string is just a sequence (array) of characters
In order to read a file name into your program you need a variable that is capable of holding a string
- char file_name[MAX_NAME_LENGTH+1];
- This declaration provides an array of characters to store the string in
const int MAX_NAME_LENGTH = 80;
char file_name[MAX_NAME_LENGTH+1];
cout << “Enter the file name (maximum of “ << MAX_NAME_LENGTH << “ characters):\n”;
cout << “OK, I will edit the file “ << file_name << endl;
in_stream.open(file_name);