<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 7, 2024 at 11:07 AM Florian Weimer <<a href="mailto:fweimer@redhat.com">fweimer@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">* Frederic Berat:<br>
<br>
> On Thu, Nov 7, 2024 at 10:27 AM Florian Weimer <<a href="mailto:fweimer@redhat.com" target="_blank">fweimer@redhat.com</a>> wrote:<br>
><br>
> * Frederic Berat:<br>
><br>
> > On Wed, Nov 6, 2024 at 6:10 PM Florian Weimer <<a href="mailto:fweimer@redhat.com" target="_blank">fweimer@redhat.com</a>> wrote:<br>
> ><br>
> > * Frédéric Bérat:<br>
> ><br>
> > > I also tested the following:<br>
> > > char s[3] = "";<br>
> > > fgets (s, 2, FILE);<br>
> > > ungetc (s[1], FILE);<br>
> > > fflush (FILE);<br>
> > > pos = lseek (SEEK_CUR);<br>
> > ><br>
> > > Which gives a `pos` value of 2.<br>
<br>
> Without unget:<br>
> fgetc: Position in stream before fflush: 1424<br>
> fgetc: Position in stream after fflush: 2<br>
<br>
That's the only value 2 in the test, and it's using fgetc, not fgets?<br></blockquote><div><br></div><div>Correct, the difference with my original test resides in the content size of the file, here I tried with the source code, which has a size of 1424 bytes, while in my original test, the text file had a size of 3 bytes.</div><div>My original assumption was that there was a difference by 1, but actually with fgets, the position seems to be set to file (buffer?) content size - 1.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
Florian<br>
<br>
</blockquote></div></div>