c++ - Best way to compare input values to read values from files -
i relatively new c++ programming , have hit 1 of first major snags in of this..
i trying figure out how read value/character generic ".txt" file on notepad. comparison want determine whether or not read entire line, can't seem read single 1 or 2 digit number, got read whole line using { 'buffername'.getline(variable, size) } when try change 'size' specific number gives me comparison error saying invalid switch 'int' or 'char' (depending on how declare variable).
any appreciated. thanks
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 character , decide delete[] buffer; return 0;
Comments
Post a Comment