Character array problem

I have to write a program that reads from a text file. It needs to read a value that is going to be a boolean value. When it reads from the file, "true", '1', and 't' all are valid ways. In a similar manner False can be represented by "false", '0' or 'f'.

When I read from the file, the c string is stored in a character array named oneString. My problem is how can I validate the '1', '0', 'f', and 't' since they are single characters. I have been trying to write a test program to get it working, so this is what I have.

#include <iostream>
#include <iomanip>
#include <cstring>
#include <fstream>
#include <cstdlib>
#include <locale>

using namespace std;

int main()
{
typedef char Line[81];
//Line oneString = "true";
//Line oneString = "false"'
//above cases work

//Line oneString = {'1'};
//Line oneString = {'0');
//Line oneString = {'f'};
Line oneString = {'t');

char test1[1] = {'1'};
char test2[1] = {'t'};
char test3[1] = {'0'};
char test4[1] = {'f'};

int j = strcmp(oneString, test3);
cout << j << endl;


if(strcmp(oneString, test1) == 0 || strcmp(oneString, "true") == 0 || strcmp(oneString, test2) == 0 )
cout << "TRUE" << endl;

else if(strcmp(oneString, test3) == 0 || strcmp(oneString, "false") == 0 || strcmp(oneString, test4) == 0)
cout << "TRUE" << endl;

else
{
cout << "ERROR - Invalid." << endl;
}

cin.ignore();
cout << "Press Enter to end program.";
cin.get();
}

What can I do to fix the problem where it doesn't properly check the cases with one character?
Can't see where you read the file.
I didn't read the file in this because I was just testing this in main before I tried doing it from the file. I was just setting up variables for the possible things it might read from the file.
I figured it out; thanks anyways.
Topic archived. No new replies allowed.