🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

abrir un fichero sin saber su nombre

#10382
From: Ferm�n Gal�n M�rquez
Date: Sat, 02 Mar 2002 21:11
26 lines
1845 bytes
Hola,

Tengo un programa (C++) que necesita abrir un fichero cuyo
nombre exacto se desconoce en tiempo de compilaci�n
(solo s� que tiene la forma XXXX-datos.tmp).

La soluci�n que uso ahora es realizar una llamada a la
shell para que renombre el fichero a un nombre conocido
y luego abrir normalmente. Algo as� como

comand("mv *-datos.tmp datos.tmp");
f = open ("datos.tmp", "r");

Mi duda es si habr� una manera m�s "elegante" de hacerlo,
sin llamar a la shell (adem�s, supongo que as� ganar�
eficiencia, llamar a la shell supongo que es m�s caro). Algo
as� como

f = super_open("*-datos.tmp","r");

Bueno, pues estar�a muy agradecido a quien me pudiera
ayudar!

----------------
Ferm�n
http://go.to/posadak
Technical Details
Message-ID: <debg8.78163$Q5.942765@telenews.teleline.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!213-98-91-117.uc.nombres.ttd.ES!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,bc46d88ba7bd7fd7,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-03-03 06:20:28 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!213-98-91-117.uc.nombres.ttd.ES!not-for-mail
From: "Ferm�n Gal�n M�rquez" <fgalan@teleline.es>
Newsgroups: es.comp.os.linux.programacion
Subject: abrir un fichero sin saber su nombre
Date: Sat, 02 Mar 2002 21:11:37 GMT
Organization: Terra Networks
Lines: 28
Message-ID: <debg8.78163$Q5.942765@telenews.teleline.es>
NNTP-Posting-Host: 213-98-91-117.uc.nombres.ttd.es (213.98.91.117)
X-Trace: fu-berlin.de 1015165227 10286893 213.98.91.117 (16 [63420])
X-Orig-Path: julieta.escomposlinux.org!helvete!telenews.teleline.es!not-for-mail
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Received-Date: Sat, 02 Mar 2002 22:11:37 MET (telenews.teleline.es)