I normally have no problems using strings in this manner, but this is the first time to use the .c_str() function to use a variable and two strings to create a file path for calling a file, and its giving me operational errors.
char fileName [12];
char path [12] = "C:\\";
cout << "Please Enter the date to search for: \n"
<< "(NOTE: MUST BE IN MONTH DAY YEAR FORMAT";
cin >> fileName;
path += fileName;
ifstream fin;
fin.open (path.c_str(), ios::in | ios::nocreate);
error C2297: '+=' : illegal, right operand has type 'char [12]'
c:\hehp\viewer\viewer.cpp(98) :
error C2228: left of '.c_str' must have class/struct/union type
I am not overly familiar with string classes but I am reading that now, trying to understand how .c_str() function is being used with the strings I've created and why it is not happy with my code...