Сообщение Re[43]: Как в одну строку кода прочитать содержимое файла в от 09.01.2024 15:08
Изменено 09.01.2024 15:14 rg45
R>>Ну, так что тебе мешает? Недостаток мозга, или что?
·>
·>pos_type seekoff(off_type off, ios_base::seekdir way,
·> ios_base::openmode which
·> = ios_base::in | ios_base::out);
·>3 Effects: Alters the stream positions within one or more of the controlled sequences in a way that is defined separately for each class derived from basic_streambuf in this Clause ([stringbuf.virtuals], [filebuf.virtuals]).
·>4 Default behavior: Returns pos_type(off_type(-1)).
Сюда посмотри, тупорез:
http://coliru.stacked-crooked.com/a/a9b4afe0b8455a6a
Нихера твой tellg() не возвращает pos_type(-1) в этом случае. А вместо этого возвращает максимальное знаковое положительное число. Нужно разжевывать, или сам выводы сделаешь?
R>>Ну, так что тебе мешает? Недостаток мозга, или что?
·>
·>pos_type seekoff(off_type off, ios_base::seekdir way,
·> ios_base::openmode which
·> = ios_base::in | ios_base::out);
·>3 Effects: Alters the stream positions within one or more of the controlled sequences in a way that is defined separately for each class derived from basic_streambuf in this Clause ([stringbuf.virtuals], [filebuf.virtuals]).
·>4 Default behavior: Returns pos_type(off_type(-1)).
Сюда посмотри, тупорез:
http://coliru.stacked-crooked.com/a/e04a1976fb307859
Нихера твой tellg() не возвращает ни pos_type(-1), ни pos_type(off_type(-1)) в этом случае. А вместо этого возвращает максимальное знаковое положительное число. Нужно разжевывать, или сам выводы сделаешь?