InputOutput Capability


Input/Output Capability

The I/O functionality in C is rudimentary at best. You spend a lot of time using nonintuitive functions such as scanf() , sscanf () , and gets() . Some of the functions will read a newline character at the end of a line and some will not. These functions also tend to be quite format-specific. You have to specify exactly what variable type is to be read and returned from these functions. It is easy to run into conversion problems between, say, a float and a double . Reading and parsing an input file can be an intricate and error-prone process.

Java has a much improved I/O functionality over that offered by C. Like C, Java uses a stream-based I/O system. A data stream is simply an abstraction that represents a data connection between a source and a destination. Java provides a wide array of specialized I/O stream classes in two general categories. Character streams are designed to read and write character data. The characters can be read in one at a time or an entire line of data can be read in as a String . Byte streams are intended to read and write binary data. The data can be read in one byte at a time or an entire buffer of byte data can be read.



Technical Java. Applications for Science and Engineering
Technical Java: Applications for Science and Engineering
ISBN: 0131018159
EAN: 2147483647
Year: 2003
Pages: 281
Authors: Grant Palmer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net