FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Integration
(Moderators: fry, REAS)
   import java.io.*;
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: import java.io.*;  (Read 5260 times)
nay

WWW
import java.io.*;
« on: Apr 12th, 2005, 10:36pm »

hi all
 
i want to import java.io.* so that i can append text to the end of a file (without reading > concatenating > writing)
 
but when i add import java.io.*; to the top of my code i get:
expecting EOF, found 'whatever the next bit of code is'
 
i guess that importing java modules isn't done this way?
 
any advice on how to do this greatly appreciated.
 
fry


WWW
Re: import java.io.*;
« Reply #1 on: Apr 12th, 2005, 11:58pm »

you don't need to import it, it should be imported by default.
 
nay

WWW
Re: import java.io.*;
« Reply #2 on: Apr 14th, 2005, 11:31pm »

huh, well that was easy
thanks fry
 
in case anyone else searches the forum for how to append text to the end of a file:
 
FileWriter file;
String test = "teststring";
 try  
   {  
  file = new FileWriter("test.txt", true); //bool tells to append
  file.write("\n"+test, 0, test.length()+1); //(string, start char, end char)
  file.close();
        }  
     catch(Exception e)  
   {  
     println("Error: Can't open file!");
    }
« Last Edit: Apr 14th, 2005, 11:47pm by nay »  
Pages: 1 

« Previous topic | Next topic »