This seems simple, but it's not working. There IS a text file in the same directory, but it's not being opened (and with the ios::in | ios::out, it should open even if it doesn't exist).
I also ran into trouble trying to use infile.fail, which is why I used !infile.
Thanks for any help!
Rich
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
// inputting a char from a file to a var and the console
char ch; // The test file has one character, 'A'.
fstream infile;
infile.open("charsfile.txt", ios::in | ios::out);
if (!infile)
cout << "File didn't open" << endl;
infile.get(ch);
cout << "The test character is: " << ch << endl;
return 0;
}