--- rtl/inc/text.inc 2026-02-10 09:03:50 +++ rtl/inc/text.inc2026-02-10 09:11:32 @@ -1815,9 +1815,12 @@ function fpc_GetBuf_Text(var f : Text) : pchar; iocheck; compilerproc; Begin - Result:=@TextRec(f).Bufptr^[TextRec(f).BufEnd]; if TextRec(f).mode=fmOutput then - exit; + begin + Result:=@TextRec(f).Bufptr^[TextRec(f).BufPos]; + exit; + end; + Result:=@TextRec(f).Bufptr^[TextRec(f).BufEnd]; If not CheckRead(f) then exit; If TextRec(f).BufPos>=TextRec(f).BufEnd Then