having a problem using variables in file calls
I've seen several postings in regards to this and tried about 40 times to correct the problem, using different methods. My code needs to open a remote file not in the same directory so when I put the variable name in my file path it is not finding my file.
cout << "Please Enter the Date you would like to search for: \n"
<< "(NOTE: MUST BE IN MONTH DAY YEAR FORMAT )";
cin >> fileName;
fin.open ("C:\\fileName", ios::in | ios::nocreate);
cout <<"ERROR: Unable to open the snap server file"<<endl;
I've tried using fin.open("C:\\(fileName.c_str())) and still can't find my file, which I know is there. if enter the string name not using the variable it finds the file just fine, and I if put the file in the same directory that the compiler is using the I can use the variable name "fileName" it finds the file fine. ???? What am I doing wrong when I use a path name and the string varialbe together? Please help.....:confused: :confused: