Java-source: Ecrire des valeurs int dans un fichier

Author:

Java-source: Ecrire des valeurs int dans un fichier
{filelink=309}

/***** Code de MesExemples.com *******/
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

class WriteIntToFile {

public static void main(String[] args) {

String strFilePath = "C://test.txt";

try
{

FileOutputStream fout = new FileOutputStream(strFilePath);
DataOutputStream dos = new DataOutputStream(fout);

int i = 100;


dos.writeInt(i);


dos.close();

}
catch (IOException e)
{
System.out.println("IOException : " + e);
}

}
}

Leave a Reply

Your email address will not be published. Required fields are marked *