hey guys how are u all doing? Im having problems using the LineNumberReader class in this follwing method that you will see im trying to print out the line number in front of the actual line of text and all i get is this:
99nulli beg for this thing to work
work is good
this is the method:
void grep(
String t)
{
String s = "";
try
{
b = new BufferedReader(new FileReader(f));
c = new LineNumberReader(new FileReader(f));
while((s=b.readLine())!=null)
{
search(t,s);
if (search(t,s)==true)
line = c.getLineNumber()+ '\t' + line + s + '\n';
}
}
catch(FileNotFoundException e )
{
e.printStackTrace();
}
catch(IOException d)
{
d.printStackTrace();
}
finally
{
try
{
b.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
please help, and thanks in advance