EOF character through System.in [message #155326] |
Sat, 03 June 2006 11:32 |
Eclipse User |
|
|
|
Originally posted by: juanfdezgcia.yahoo.es
Hello, I'm trying to introduce the EOF character in the Eclipse SDK
3.1.2's console view and I don't know how to do it, the problem is that
I'm testing a very elementary program and I'm using a wrapper Reader, here
goes the code snippet:
<<
PushbackInputStream in = new PushbackInputStream(System.in);
//bla, bla, bla...
int b;
do {
//bla, bla, bla...
for( ; (b = in.read()) == b1; n++)
;
//bla, bla, bla...
} while (b != -1)
>>
the PushbackInputStream.reader() returns a -1 when it finds the end of
stream character but I don't know how to introduce it throug the console,
I've tried with Ctrl+Z (the SUB control character, i.e., 0x1A or 26 in
US-ASCII) but a '→' is shown (see Note_1 if curious), the end of
stream is easyly read in a file, you save the file, close it and
automatically you're done.
Any bit of help will be apreciated.
Note_1: in my system Eclipse uses the code page Cp 850, there's a 'Edit >
Set Encoding...' option, and there it's said that Cp 1252 is used, and
even you can select another Encoding if you want, but whith the default,
when entering a code point through [Alt + numeric keypad number], the Cp
850 characters are shown, not the Cp 1252, is spite of the fact that
Eclipse states it uses <<Text file encoding: Default (inherited from
container: Cp1252)>>.
|
|
|
Powered by
FUDForum. Page generated in 0.02667 seconds