robbies
Posts: 2
Nickname: robbies
Registered: Jan, 2003
|
|
Re: A 13 year old java programmer.Please help me
|
Posted: Jan 5, 2003 9:38 AM
|
|
you should use java.io.File;
i paste some code you can refer to :
import java.io.*; public class PushBack {
public static void main(String[] a) throws IOException { FileReader fr=new FileReader("test.txt"); PushbackReader pbr=new PushbackReader(fr,20); //------------------------------------------------------ --------- char[] arr=new char[15]; pbr.read(arr,0,arr.length); for(int i=0;i<arr.length;i++){ System.out.println(arr[i]); } System.out.println("------------"); //--------------------------------------- ------------------------ char[] app={'f','f','f','f'}; pbr.unread(app,0,app.length); for(int i=0;i<app.length;i++){ System.out.println(app[i]); } System.out.println("------------"); //--------------------------------------- ------------------------ char[] acc=new char[4]; pbr.read(acc,0,acc.length); for(int i=0;i<acc.length;i++){ System.out.println(acc[i]); } System.out.println("------------"); } }
maybe above code is not exact to your question but you can understand how to read and write from a file through it
|
|