DanShadow wrote:
Ok, so that works with reading from a file. But could you explain how to write to a file? tx
As for File Output:
	  | Java: | 	
		  import java.io.*;
public class FileOutput {
        
        public static void main  ( String [] args  ){
                try{
                        BufferedWriter out =  new BufferedWriter (new FileWriter("MyFile.txt"));
 
                        out. write("Hello! I am creating a new file."
                        +  " If a file named \"My File.txt\" existed already, you would lose it!");
 
                        out. close();
                         BufferedWriter outAppend =  new BufferedWriter (new FileWriter("MyFile.txt", true));
 
                        outAppend. append("This is being appended to the end of the old \"MyFile.txt\"!"
                        +  "This is because I passed in a second argument, 'true', to the FileWriter constructor.");
 
                        outAppend. close();
                 } catch (IOException f ) {
                        System. err. println("You must not have write permissions to this directory!");
                 }
        }
}  |