Q:

Best way to compare input values to read values from files

I am relatively new to c++ programming and I have hit one of my first major snags in all of this..
I am trying to figure out how to read a value/character from a generic ".txt" file that is on notepad.  With that comparison I want to determine whether or not to read that entire line, but I can't seem to just read the single one or two digit number, I got it to read the whole line using  { 'buffername'.getline(variable, size)  }  but when I try to change the 'size' to a specific number it gives me a comparison error saying that its invalid to switch to 'int' or 'char' (depending on how I declare the variable).
Any help is appreciated.
    Thanks

A:

  int length = 2;
  char * buffer;    
  ifstream is;
  is.open ("test.txt", ios::binary );    

  // allocate memory:
  buffer = new char [length];

  // read 2 char
  is.read (buffer,length);

  //Compare the character and decide     

  delete[] buffer;
  return 0;

