How to set maximum read length for a stream in C++?
问题 I'm reading data from a stream into a char array of a given length, and I'd like to make the maximum width of read to be large enough to fit in that char array. The reason I use a char array is that part of my specification is that the length of any individual token cannot exceed a certain value, so I'm saving myself some constructor calls. I thought width() did what I wanted, but I was apparently wrong... EDIT: I'm using the stream extraction operators to perform the extraction, since these