RandomAccessFile.readChar() |= '\n' does not work?
From: harald (please_noSpam_at_gmx.de)
Date: 12/27/04
- Next message: Darryl L. Pierce: "Re: which SDK for j2me wireless toolkit on debian?"
- Previous message: SPG: "Re: Runtime Exception: underlying model changing???"
- Next in thread: klynn47_at_comcast.net: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Reply: klynn47_at_comcast.net: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Reply: Tony Morris: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Dec 2004 22:25:34 +0100
Hi,
I try to read a RandomAccessFile until the first newline and to count
all tabs.
But the following just won't do the job:
***********************
RandomAccessFile in = new RandomAccessFile(filename);
char c;
int num=0;
while ( (c=in.readChar()) != '\n' )
{
if (c == '\t')
{
num++;
}
}
***********************
According to the debugger the line with "num++" is never reached.
if I execute "print c" while jdb is in this loop, he tells me "c = ?"
Then an EOFException with message "null" is thrown.
Can someone tell me what goes wrong?
Wo liegt denn bitte mein Denkfehler?
Regards and thanks in advance,
Harald
- Next message: Darryl L. Pierce: "Re: which SDK for j2me wireless toolkit on debian?"
- Previous message: SPG: "Re: Runtime Exception: underlying model changing???"
- Next in thread: klynn47_at_comcast.net: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Reply: klynn47_at_comcast.net: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Reply: Tony Morris: "Re: RandomAccessFile.readChar() |= '\n' does not work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]