🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #13370

Re: descriptor de fichero

#13370
From: J.A. Gutierrez
Date: Mon, 26 Feb 2001 11:27
29 lines
1845 bytes
OscarUC <oscaruc@no_spam_bigfoot.com> wrote:

: una preguntilla, seguro que la respuesta es muy facil, pero estoy embotado y
: soy incapaz de verlo ahora :-P. �C�mo puedo saber si un descriptor de
: fichero est� abierto? Es decir, tengo un entero y quiero saber si es un
: descriptor asociado a un fichero abierto.


n=open("/etc/motd", O_RDONLY);
printf("%d\n",n);
j=fcntl (4,F_GETFL);
if (j<0) perror("fcntl");
printf("%d\n",j);
j=fcntl (n,F_GETFL);
if (j<0) perror("fcntl");
printf("%d\n",j);
close(n);

3
fcntl: Bad file number
-1
0


-- 
PGP and other useless info at      \                 La ciencia-ficcion es
http://www.cps.unizar.es/~spd/      \                 ese futuro en el que
finger://daphne.cps.unizar.es/spd    \                 lo seguro es que ya
ftp://ivo.cps.unizar.es/pub/          \    (F. Alfaro)  no seremos jovenes
Technical Details
Message-ID: <97dej3$7ok$1@news.unizar.es>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!bloom-beacon.mit.edu!news.rediris.es!news.unizar.es!not-for-mail
References: <97d3as$2no$1@news.unizar.es>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,7a7c5c732d9d266b
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-02-26 03:16:05 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!bloom-beacon.mit.edu!news.rediris.es!news.unizar.es!not-for-mail
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: descriptor de fichero
Date: 26 Feb 2001 11:27:31 GMT
Organization: Rank
Lines: 29
Message-ID: <97dej3$7ok$1@news.unizar.es>
References: <97d3as$2no$1@news.unizar.es>
NNTP-Posting-Host: daphne.cps.unizar.es
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: news.unizar.es 983186851 7956 155.210.152.20 (26 Feb 2001 11:27:31 GMT)
X-Complaints-To: usenet@news.unizar.es
NNTP-Posting-Date: 26 Feb 2001 11:27:31 GMT
User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (IRIX/6.2 (IP22))