Bug: fgets always reads from stdin

lawson_whitney at juno.com lawson_whitney at juno.com
Mon Mar 11 09:08:06 CST 2002


On Mon, 11 Mar 2002, Andriy Palamarchuk wrote:

> I'm trying to use function fgets, but it always reads
> from standard input.
>
> Here is the test code:

Here it is compiled with lcc.exe:

[whit at giftie cat]$ wine lcc.exe -- -c cat.c
fixme:console:SetConsoleCtrlHandler (0x425d48,1) - no error checking or testing
yet
fixme:console:SetConsoleCtrlHandler (0x425d48,0) - no error checking or testing
yet
[whit at giftie cat]$ wine lcclnk.exe cat.obj
[whit at giftie cat]$ wine cat.exe
high their
[whit at giftie cat]$ echo 'oops!' >'1.txt'
[whit at giftie cat]$ wine cat.exe
oops!

[whit at giftie cat]$ cat cat.c >1.txt
[whit at giftie cat]$ wine cat.exe
#include <stdio.h>
#include <stdlib.h>
int main()
{
    FILE *reg_file = fopen("1.txt", "r");
    if (!reg_file)
    {
        perror("");
        printf("Can't open file \"%s\"\n", "1.txt");
        exit(1);
    }
    {
        char buf[100];
        while (fgets(buf, 100, reg_file))
        {
            printf("%s", buf);
        }
        exit(1);
    }
}

[whit at giftie cat]$ cat /dev/vcc/4|fold|trail>oof

Lawson
---oof---



________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.



More information about the wine-devel mailing list