[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] "tcc -run -" closes stdin so that program itself can't re
From: |
noneofyourbusiness |
Subject: |
[Tinycc-devel] "tcc -run -" closes stdin so that program itself can't read from stdin |
Date: |
Wed, 29 Nov 2023 19:50:10 +0100 |
> But if I try to read foo.c from stdin then foo.c itself is unable to
> read, b.c. stdin is already closed:
No, it isn't.
As demonstrated in the following code snippet, it's not closed,
there is simply nothing else to read from it (tcc reads stdin until EOF).
#define _XOPEN_SOURCE 700
#include <stdio.h>
int
main()
{
char buf[1024] = {0};
fgets(buf, sizeof buf, stdin);
perror("fgets");
if (feof(stdin)) puts("EOF");
return 0;
}