Input and Output

Welcome!
As stated before – any meaningful program will have input and output.

Input

A program’s input is any information that is given to the program.
The most common input methods are:

  • Command line arguments
    • When running a program from command line – it is possible to add additional arguments that specify how the program should behave.
  • Console input
    • When writing console applications (which are applications that run in console mode, and not using graphical user interface), the program can ask the user to supply input by typing in the console in which the program is running.
    • The first programs that we will write in this guide will be console applications that will receive console input.
    • In most cases – the console input is the “Standard Input” of the program.
  • Graphical User Interface Input
    • Most modern programs are actually applications that have Graphical user interface.
    • This kind of input is usually received from text fields and buttons that appear on the screen.
    • Your web browser is an example of a program that has a graphical user interface, which contain text fields and buttons, and receives its’ input from the “Address bar” text field, and other text fields and buttons inside web pages that you browse to.
  • Files
    • Files are blocks of information that are temporarily, or persistently stored on storage devices, like hard disks, flash drives, or any other form that allows storage.
    • Most of the modern applications use files in order to store and load information that was stored earlier by them, or by other programs.
  • Network
    • Programs can also receive their input from the network, like web servers and web browsers, file transfer applications, and any application that can receive input that is received using a network interface.

 

Most programs utilize more than one input method. For example, a web browser receives input using the following methods:

  • Graphical user interface input – When you enter a web address, or click on links or on any other item within a web page, or web browser button.
  • Files – The web browser have multiple data files that it uses in order to function and supply all of its’ capabilities. It also uses files in order to cache web pages and different information that is stored on the computer that runs the web browser.
  • Network – The web pages that the browser is downloading from the different web sites are input that is received be the browser using the network interface.
  • Command line arguments – Even though you don’t specify any command line arguments when you start your web browser, in many cases it has additional command line arguments in its’ shortcut link, or additional command line arguments are added when child processes are created.

Output

A program’s output is any information that the program exposes to any external element.
The available output methods are very similar to the available input methods, as in many cases – the generated output is designed to be an input of an external element:

  • Console output
    • When writing console applications (which are applications that run in console mode, and not using graphical user interface), the program supply its’ output by writing it in the console in which the program is running.
    • The first programs that we will write in this guide will be console applications that will write its’ output to the console.
    • In most cases – the console outputĀ  is the “Standard Output” of the program.
  • Graphical User Interface Output
    • This kind of output is usually generated by displaying text fields and buttons that appear on the screen.
    • Your web browser is an example of a program that has a graphical user interface, which contain text fields and buttons, and displays the contents of the web pages that you browse to – on the screen.
    • Information that is sent to the Graphical user interface can be considered to be the input for the human that is using this interface.
  • Files
    • Most of the modern applications use files in order to store and load information that was stored earlier by them, or by other programs.
  • Network
    • Programs can also transmit their output over the network, like web servers, file transfer applications, and any application that transmits information using a network interface.

We will explain and utilize different input and output methods throughout the exercises and examples in this beginners guide.