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@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@giftie cat]$ wine lcclnk.exe cat.obj [whit@giftie cat]$ wine cat.exe high their [whit@giftie cat]$ echo 'oops!' >'1.txt' [whit@giftie cat]$ wine cat.exe oops!
[whit@giftie cat]$ cat cat.c >1.txt [whit@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@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/.