?EOF character for file of integers
How end of file character is traced in an file of integers for simple java applications using streams
What is an EOF character?
public abstract int read() throws IOException
/*
Reads the next byte of data from the input stream.
The value byte is returned as an int in the range 0 to 255.
If no byte is available because the end of the stream has been reached,
the value -1 is returned.
This method blocks until input data is available,
the end of the stream is detected, or an exception is thrown.
*/
thanx fr ur responsebut i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character
thanx fr ur responsebut i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character
thanx fr ur response
but i wanna kno if I take input from the user in form of integers store them in a file and then to read it ,if i use read() it cannot read integers like 23, 287, 24556 and if i use readInt() it cannot trace -1 as eof character
For input and output of integres i'm associating dataInput dataoutputstreams with file streams
Please spell correctly. Anyway, read() reads a byte and yields it as an int as described in the API and cited above. If you want to read a multibyte integer, you have to know how it is composed. If you need textual representation, it is a different situation.