This is part of a bigger program, but essentially, what's happening is that "stringB" isn't being allowed to be written properly. After I type in 10 characters it tells me that the length isn't right. If I hit enter 9 times, the prompt to retry comes up, and it will accept the 10 characters. This is after a lot of cout/cin back and forth. I started using cin.sync() and it seemed to alleviate some issues, but I'm not really sure if buffers are the root cause, or if I'm just maybe losing my mind. Code follows:
If you're relying on the behavior of cin.sync(), you're relying on implementation defined behavior. In some environments cin.sync() does nothing at all.
cin.read is something you don't see very often. read and write is primarily meant to be used with binary files, not text streams.
Very interesting! Thank you for your informative response! If cin.read() is for binary, how would that be implemented? Unless cin is actually reading the binary value of the keys typed. I hadn't thought of incrementing the 'tries' in the while condition and I need to read a bit more on strings. Thank You Again!