On Mon, 11 Mar 2002, Andriy Palamarchuk wrote:
I'm trying to use function fgets, but it always reads from standard input.
I can't duplicate your results.
---cat.c--- #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); } }
---cat.spec--- name cat type win32 mode cuiexe init main
import kernel32.dll import ntdll.dll import msvcrt.dll
I used winemaker on the source, then added msvcrt.dll to the spec.
[whit@giftie cat]$ ./cat No such file or directory Can't open file "1.txt" [whit@giftie cat]$ echo 1.txt >'1.txt' [whit@giftie cat]$ ./cat 1.txt [whit@giftie cat]$ echo high their >'1.txt' [whit@giftie cat]$ ./cat high their
Lawson
Probable user head space error. - Dennis A. Moore
________________________________________________________________ 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/.