tags:

views:

493

answers:

3

Hi i'm begginner in java i'm reading characters from file(FileReader) but when i read length of the i'm not getting correct result, its displaying less size compare to correct one.plz reply wat is the problem.

thanks for reply

+1  A: 

*"Hi i'm begginner in java i'm reading characters from file(FileReader) but when i read length of the i'm not getting correct result, its displaying less size compare to correct one.plz reply wat is the problem.

thanks for reply"*

Could you please review your question and spell out your problem at greater length and proof-read your edited version to make sure all the words that you intended to be in the post are actually in the posting.

Please give some specifics such as:

  • what is the expected length?
  • why do you expect that length?
  • what is the returned length?
  • what is the code you are using to get that return?
duncan
A: 

Usually, determining file length should not be done by reading it. It should be done by using File.length()

abyx
A: 

Number of characters read from a file may not be equal to file size (encoding makes the diference). But, as abyx wrote, if size of a file in bytes is what you need, go with File.length().

david a.