Output File Stream - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Output File Stream.
Encyclopedia Article

Output File Stream - Research Article from World of Computer Science

This encyclopedia article consists of approximately 1 page of information about Output File Stream.
This section contains 234 words
(approx. 1 page at 300 words per page)

Output is anything, meaningful or otherwise, that comes out of a computer. In a number of programming languages, including C++ and Java, a type of output is termed the output file stream. The output file stream refers to the stream of information that flows between two objects. In this case, one of the objects is information entered via a keyboard or from a file (the sender) and the other object is a file to which the information is to be routed (the receiver).

The file stream is in the form of bytes, such as ASCII characters. The output file stream can be used to place the output from a program directly into a file. When a file is opened, an object is created and a stream is associated with that object. The object that is opened is referred to as an ofstream object. The ofstream can write the data to an output file.

Generally, the output file stream ofstream is written as

  • .open()

The variable name can be any identifier that is recognizable in the programming language; out_file, for example.

The output file stream is closed when a particular task is completed (when the data has been placed in a file). To continue the above example, if the variable name selected was out_file, then the command to close would be:

  • out_file.close()
This section contains 234 words
(approx. 1 page at 300 words per page)
Copyrights
Gale
Output File Stream from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.