Bug: fgets always reads from stdin
lawson_whitney at juno.com
lawson_whitney at juno.com
Mon Mar 11 08:57:18 CST 2002
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 at giftie cat]$ ./cat
No such file or directory
Can't open file "1.txt"
[whit at giftie cat]$ echo 1.txt >'1.txt'
[whit at giftie cat]$ ./cat
1.txt
[whit at giftie cat]$ echo high their >'1.txt'
[whit at 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/.
More information about the wine-devel
mailing list