Mettre en argument un nom de fichier
Bonjour à tous,
j'ai crée un programme pour inscrire dans un fichier de sortie du texte.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| import java.io.*;
public class Fichier_OuputWriteHello {
public static void main(String[] args) throws IOException {
String nomfich;
String phrase;
nomfich = "fichier_sortie.dat";
DataOutputStream sortie = new DataOutputStream (new FileOutputStream (nomfich));
do {
phrase = "Hello World";
sortie.writeChars (phrase);
}
while (phrase != phrase);
sortie.close();
System.out.println ("***Fin de création fichier***");
}
} |
Maintenant je voudrais mettre le nom du fichier de sortie en "argument".
Je suis allé dans les options dans éclispe :
Open Run Dialog -> onglet (x)=argument
Cependant je ne sais pas comment cela fonctionne...
Pouvez m'aider ...Je voudrais mettre le fichier fichier_sortie.dat en argument
MERCI