String time=Read_one_Line();
public static String Read_one_Line() throws FileNotFoundException, IOException
{
FileInputStream fin=new FileInputStream("sample.txt");
BufferedReader br=new BufferedReader(new InputStreamReader(fin));
str=br.readLine();
next_line=br.readLine();
return next_line;
}
Each time it should read one line from text file called "sample.txt" and return it. next time it should return next line and so on....
Contents of sample.txt are:
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:310
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:10
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:380
Date:0 Year:0 Hour:0 Minute:0 Seconds:10 MilliSeconds:-840
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
Date:0 Year:0 Hour:0 Minute:0 Seconds:0 MilliSeconds:0
But rather its reading and returning first line only each time.. please tell me how to increment to next line and return it when i call this function next time.