import java.io.*;
class CreatingFile
{
public static void main(String args[]) throws IOException
{
int i;
FileOutputStream fout;
char c;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter characters, 'q' to quit.");
try {
// open output file
fout = new FileOutputStream("D:\\Book\\a.txt");
}
catch(FileNotFoundException e)
{
System.out.println("Error Opening Output File");
return;
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Usage: CopyFile From To");
return;
}
try {
do {
c = (char) br.read();
fout.write(c);
} while(c != 'q');
} catch(IOException e) {
System.out.println("File Error");
}
fout.close();
}
}