Hello, basically I want to read an input .txt file, and check to see if '+' or '*' is at the beginning or end of the file. The file can have a space at the beginning, and that should be ok.
This is the code that I think should work, but does not. If anyone could offer me some helpful advice, it would be much appreciated. Also if you could tell me where I went wrong, that would be great too.
char firstChar[256];
size_t chars_read= 0;
while (input.good())
{
nextChar = (char) input.get();
firstChar[chars_read]=(char)input.get();
if(input)
++chars_read;
if(firstChar[1]=='+')
badInput=true;
if(firstChar[ chars_read-1]=="+")
badInput=true;
if(badInput)
break;