Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 1996 23:04:38 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-hackers@freebsd.org (FreeBSD hackers)
Cc:        jmacd@deceit.xcf.berkeley.edu
Subject:   Re: stdio problem
Message-ID:  <199605022104.XAA15002@uriah.heep.sax.de>
In-Reply-To: <3259.831046296@critter.tfs.com> from Poul-Henning Kamp at "May 2, 96 02:11:36 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
As Poul-Henning Kamp wrote:

> >   close(0);
> >   if(!freopen(argv[1], "r", stdin)) {
> 
> doing a "close(0)" is bound to confuse the stdio library.
> don't do that.

More generally spoken, mixing any kind of stdio function (fopen(),
fclose(), fread(), fwrite(), printf() etc.) with low-level functions
(syscalls in Unix: open(), close(), read(), write()) is error-prone.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605022104.XAA15002>