May 6th, 2000, 01:26 AM
Hello,
Could someone tell me how to input double(or integer) type from a file?
I had used DataInputStream for that. When I used "writeInt" to write
to a file and then used "readInt" to read from the same file, it worked.
But if I used "readInt" directly to read from a .txt or .dat file, and then
used "System.out.println" to print out the value read in, the value is
extremely large or small(something like undefined). Such as if I have
8 single digit numbers in a file, after readInt(), I'll get maybe 5 large
numbers for the output.
Thanks a lot!
Could someone tell me how to input double(or integer) type from a file?
I had used DataInputStream for that. When I used "writeInt" to write
to a file and then used "readInt" to read from the same file, it worked.
But if I used "readInt" directly to read from a .txt or .dat file, and then
used "System.out.println" to print out the value read in, the value is
extremely large or small(something like undefined). Such as if I have
8 single digit numbers in a file, after readInt(), I'll get maybe 5 large
numbers for the output.
Thanks a lot!