Hello,
I need a code-sample for reading data from a text file
(including exceptions whether there is need to, and check end-of-file
communication).
(FileReader ?)
Thanks :)
Eitan M - 15 Jul 2006 15:02 GMT
...
Also,
How can I read a whole one line (I didn't find readln() or something) ?
Thanks :)
> Hello,
>
[quoted text clipped - 4 lines]
>
> Thanks :)
charles hottel - 15 Jul 2006 18:32 GMT
> ...
> Also,
[quoted text clipped - 10 lines]
>>
>> Thanks :)
import java.io.*;
public class FileTest{
public static void main(String[] args){
try{
File data = new File("grades.txt");
if (data.exists()){
BufferedReader in = new BufferedReader(
new FileReader(data));
String line = in.readLine();
while(line != null){
System.out.println(line);
line = in.readLine();
}
in.close();
}
else
System.out.println("The grades.txt file doesn't exist");
}
catch(IOException e){
System.out.println("An IOException has occurred.");
}
}
}
IchBin - 15 Jul 2006 16:45 GMT
> Hello,
>
[quoted text clipped - 4 lines]
>
> Thanks :)
I replied to post in the other newsgroup you posted to.
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)