Re: Why can't lseek the STDIN_FILENO? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why can't lseek the STDIN_FILENO?
Date
Msg-id 123007.1687574405@sss.pgh.pa.us
Whole thread Raw
In response to Why can't lseek the STDIN_FILENO?  ("Wen Yi" <896634148@qq.com>)
List pgsql-general
"=?gb18030?B?V2VuIFlp?=" <896634148@qq.com> writes:
>     lseek(STDIN_FILENO, 0, SEEK_SET);

If you are not checking for failure return from a system call,
you are in a state of sin.

> I really don't know, why the buffer's content not be "Hello world\n"?

Probably because a tty input device is not seekable.

            regards, tom lane



pgsql-general by date:

Previous
From: "Wen Yi"
Date:
Subject: Why can't lseek the STDIN_FILENO?
Next
From: John McKown
Date:
Subject: Re: Why can't lseek the STDIN_FILENO?