🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: escribir el tamano de un fichero en otro, pero no en ascii

#985
From: gamo
Date: Mon, 24 Jul 2006 18:52
42 lines
2189 bytes
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-380724138-1153767154=:24520
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Mon, 24 Jul 2006, heltena wrote:

> Hola,
>=20
> Quiero escribir el tamano de un fichero dentro de otro fichero, pero en
> binario, osea, los cuatro bytes. Es para preparar un fichero que
> despu=E9s leo desde C. Me interesa leer los cuatro bytes y cargarlos
> directos en un int con un codigo parecido a este:
>=20
> fread(&value, 4, 1, f);  /* solo es un ejemplo */
>=20
> =BFc=F3mo puedo hacerlo?
>=20
> Gracias hasta ahora!
>=20
> PD: necesito que sea as=ED porque el c=F3digo se ejecutar=E1 en un PIC
> (leyendo una tarjeta SD) y no es que tenga muchas facilidades en ese
> procesador.
>=20
>=20
> --=20
> Saludos
>=20
>=20

Si lo hicieses en Perl
(stat)[7] te da el tama=F1o decimal en bytes
perldoc -f pack  te dice como empaquetarlos en 4 bytes=20
Lo demas es open, print, close y poco m=E1s.
Saludos=20

--=20
http://www.telecable.es/personales/gamo/
perl -e 'print 111_111_111**2,"\n";'
--8323328-380724138-1153767154=:24520--
Technical Details
Message-ID: <Pine.LNX.4.64.0607242049310.24520@jvz.es>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeed.telecable.es!cm-83-97-181-149.telecable.es!amo
References: <1153759345.956147.65760@s13g2000cwa.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,15d891730dc7298
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Newsgroups: es.comp.os.linux.programacion
Date: Mon, 24 Jul 2006 20:52:34 +0200
From: gamo <gamo@telecable.es>
X-X-Sender: amo@jvz.es
Reply-To: gamo@telecable.es
Subject: Re: escribir el tamano de un fichero en otro, pero no en ascii
In-Reply-To: <1153759345.956147.65760@s13g2000cwa.googlegroups.com>
Message-ID: <Pine.LNX.4.64.0607242049310.24520@jvz.es>
References: <1153759345.956147.65760@s13g2000cwa.googlegroups.com>
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-380724138-1153767154=:24520"
NNTP-Posting-Host: 83.97.181.149
X-Trace: filemon1.isp.telecable.es 1153767053 83.97.181.149 (24 Jul 2006 20:50:53 +0200)
Organization: TeleCable, S.A.U.
Lines: 42
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeed.telecable.es!cm-83-97-181-149.telecable.es!amo