View Single Post
  #1 (permalink)  
Old 04-06-2008, 08:20 AM
aytidaalkuhs aytidaalkuhs is offline
Member
 
Join Date: Apr 2008
Posts: 3
aytidaalkuhs is on a distinguished road
[SOLVED] file i/o problem
Hi.
I was writing a small code to facilitate text file reading and used the following code to read and display the text file.


while(handle.read()!= -1)
{
System.out.print((char)handle.read());
}
where handle is an object of FileInputStream class.
What it does is print the alternate charcters in the file starting from the second character.
Why is it behaving in such a manner? Please throw some light.

Alternatively, i used a code snippet from java 2 complete reference which is working just fine.

What i want to know is whats the problem with my logic or code and not interested in getting any new ways to do it cuz i already have a correct way to do it at hand.

Waiting..
aytidaalkuhs.
Reply With Quote
Sponsored Links