Article View: es.comp.os.linux.programacion
Article #1325Re: file descriptor incorrecto
From: Jorge S. de Lis
Date: Mon, 09 Jan 2006 19:27
Date: Mon, 09 Jan 2006 19:27
37 lines
2355 bytes
2355 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Miguel en es.comp.os.linux.programacion escribi�:
>
> /* abrimos el fichero para escritura y lo creamos si no existe */
> if((fd = open(strfile,O_APPEND | O_CREAT, 0644))<0){
Con esa sentencia no guarda nada en fd. En otros lenguajes como php por
ejemplo s�, pero en c no.
Debes hacer el open en otra sentencia y luego preguntar por fd, as�:
fd = open(strfile,O_APPEND | O_CREAT, 0644);
if(fd<0){
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iQIVAwUBQ8K5NKvCV+KC5A6ZAQJttQ/9HneOD9ss32ueyLb0dGOSOK/6uqqCKPqK
UjIuTzvq7gDTIscnlB3YkYB5wFt8nmcEN0DF9iGM5i/8+S6XDnfAKhnBmDvr7Zeb
AsHwl8O4v0gFzCZjqRXCl8vXklvs1tpQvpBQTGRBVoCMVACupVbEYc+lpTfEauF0
jP6VxfT3wrNWjNSMlub3g160xvUzbgtVKCnVqOFKfOTjzG4s6GZ7ObESK6uJ1yiP
RtyWTtndP/8N6cB5OTFYflcSgex1MXchIeEZHMOuIJzd8iZuCcUnYmpojX7sGIMD
aAavLrD85wf22PG3lbazH+ssN83hJeBau+yxO56rqeqWkmRSKRJvprWV7sJRijO9
/3co5D6y6me+eYjygSLP9dfwb2C+NQLeaWg3YiQ46bCBjneunvBeMK/1w4q3N6Xb
4DY56jRO4ZoyffPiqPf7iW59X27Jv0Ez1V/MilVIKHHIGlikFzEusc0mGuF3Y2Uv
xY/TVoEsSzZdjKWXvMJTsj4C4V3n6ngNYqPCrQ/zUyngI4BZ4GE8oU+qUPv8gwHf
THekbK7Pe/4gHzbCNTk6mHpLHm2yLUxwCnKWiNFOnL/KT/9nBXEaxz3sRWMtQIZs
dQJO+mxkdhw6iOduz8vX2KbuC3ZEnbaFHJw/Ik+M/kKaulKwvZ8MEiAEvwvdZnM6
4Gr/e6v8tgI=
=rNWA
-----END PGP SIGNATURE-----
Technical Details
Message-ID:
<dpudir$bg8$1@cagarruta.escomposlinux.org>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!news.antakira.com!cagarruta.escomposlinux.org!escomposlinux.org!not-for-mailReferences:
<y0wwf.643617$E72.5691575@telenews.teleline.es>Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,2934154e59ab408e X-Google-Attributes: gidf86c8,public X-Google-Language: ENGLISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news.glorb.com!news.antakira.com!cagarruta.escomposlinux.org!escomposlinux.org!not-for-mail From: "Jorge S. de Lis" <gentakojima.antispam.quitar@gmail.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: file descriptor incorrecto Date: Mon, 09 Jan 2006 20:27:39 +0100 Organization: escomposlinux.org Lines: 37 Message-ID: <dpudir$bg8$1@cagarruta.escomposlinux.org> References: <y0wwf.643617$E72.5691575@telenews.teleline.es> Reply-To: gentakojima.antispam.quitar@gmail.com NNTP-Posting-Host: cm70140.red.mundo-r.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Trace: cagarruta.escomposlinux.org 1136834971 11784 213.60.70.140 (9 Jan 2006 19:29:31 GMT) X-Complaints-To: aherrerm@escomposlinux.org NNTP-Posting-Date: Mon, 9 Jan 2006 19:29:31 +0000 (UTC) User-Agent: KNode/0.9.2