Here's my problem:
The user needs to enter a char/string for a .dat file with a max of 15 characters. I've tried to use both a char and a string to make sure the user enters 15 or less characters. If I use char, and if the user inputs more than 15 characters, the program goes into a loop for the next cin. If I use string, I can't truncate the string to 15 characters, and I end up with an incorrectly formatted file because the full string gets written to the .dat file.
I'd like to know how I can use either string or char to get the user to input 15 or less characters without having any overflows where the next cin goes into a seemingly infinite loop.