package testy;
import java.io.*;
public class A_gen {
static File file=null;
public static void main(String[] args)
{
try {
InputStreamReader isr=null;
BufferedReader bur=null;
FileOutputStream fos=null;
isr=new InputStreamReader(System.in);
bur =new BufferedReader(isr);
fos=new FileOutputStream(".\\src\\test.txt",true);
String s;
System.out.println("------------------------");
System.out.println("input string:");
while(!(s=bur.readLine()).equals("exit"))
{
fos.write((s+"\n").getBytes());
}
System.out.println("Done!");
bur.close();
isr.close();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
file=new File(".\\src\\test.txt");
System.out.print("Reading contents of " + file.getCanonicalPath());
BufferedReader in = new BufferedReader(new FileReader(file));
String line="\n";
do{
System.out.println(line);
line = in.readLine();
}while(line != null);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}