 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ciccio Pasticcio Guest
|
Posted: Thu Jun 23, 2005 3:42 pm Post subject: [newbie] - Gestione file su HD |
|
|
Qualcuno mi può dare un dritta plz?
non riesco a trovare nessuna guida a riguardo e programmo in java solo da
pochi giorni.
Volevo sapere come fare un programma che crea file con nomi"sequenziali",
nel senso che all'inizio crea un file Nome001, se esiste crea il file
Nome002 ecc.
Ho visto che esiste il comando exista() ma non ho capito bene come funzione,
anche perchè se non ho capito male la classe File crea un puntatore ad un
file, non il file vero e prorprio.
Grazie per l'aiuto
|
|
| Back to top |
|
 |
pioneer@inwind.it Guest
|
Posted: Thu Jun 23, 2005 3:53 pm Post subject: Re: - Gestione file su HD |
|
|
Un metodo (probabilmente si può fare anche di meglio) è
File nuovoFile;
for (int i=1;i>0;i++){
if (!new File("Nome"+i).exists()){
nuovoFile = new File("Nome"+i);
i= -1;
}
}
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|