The way I woul do it is:
BufferedReader in = new BufferedReader(new FileReader("foo"));
then you can do something like:
String s = in.readLine();
Then you can use StringTokenizer on the new string. StringTokenizer is a
little simpler to use than StreamTokenizer. If all you are doing is
break
Use a StreamTokenizer to break the input stream into tokens, using
whitespace as the quote character.
Daniel Ignat wrote:
>
>
> now .. how can I read from file
> first line is:
>
> May 4 15:51:04 dexter pppd[304]: local IP address *.*.*.*
>
> - in my scenario I need to read first line and:
hi
import java.io.*;
public class f_open
{
public static void main (String args[])
{
File f = new File ("message.test",);
if(f.exists())
System.out.println(f + " exist");
else
System.out.println(f + &