Programs for Programmers

qtConsole from QT Software

A Fortran Library for Configuring the Output to Windows' Console

Standard Fortran does not offer any way to alter the output to the Windows Console (DOS box) when using READ and WRITE's.  qtConsole offers the programmer various ways to configure the output including:

  • Coloured text and numbers
  • Positioning the cursor
  • Clearing the console.
  • Position the console window relative to the desktop
  • Change of the number of character rows and columns to be buffered by a console.

qtConsole list of functions

Most Fortran programs use READ(*,...), PRINT and WRITE(*,...) statements for console output (under Windows the console is also referred to as the DOS box, DOS command window). The Fortran standard stipulates the use of one single colour (usually white text on black background). But, with the qtConsole function qtConSetTextColor a foreground and background colour can be set (256 colour combinations are at your disposal). With this, your PRINT and WRITE(*,...) commands will output coloured texts and numbers.

qtConsole colour codes

Additionally, the function qtConWrite allows the position of text output (by row and column specification). With this, you may highlight texts and numbers, so you can catch the users attention, for example, if a value runs out of range.

qtConsole cursor positioning demonstration

Also, the size of the console and the size of the console window can be controlled. To clear the console, simply call qtConClearConsole.

If you think the console's cursor is too small - default size is usually 25% of the font size - change its size ny calling qtConSetConsoleCursorSize, for example to maximize it to 100%. Or if you want to make the cursor invisible, give it a size of 0.

Within the coordinates range of a console the cursor can be positioned calling qtConSetCursorPosition. Then, the output of a PRINT and WRITE(*,...) command starts at the cursor position set. Or a READ(*,...) command expects user input starting at that cursor position.

Here is complete overview of the qtConsole functions:

qtConsole Function Function
Initializaton
qtConInitialize  Iinitialize qtConsole
Console Size and Position
qtConGetConsoleBufferSize Get the size (rows and columns) of the internal console buffer
qtConSetConsoleBufferSize Change the size (rows and columns) of the internal console buffer
qtConGetConsoleCoordinatesRange Get the console coordinates' range
qtConGetLargestConsoleWindowSize Get the maximum size of the console window
qtConGetConsoleWindowCoordinates Get the coordinates of the console window (relative to the desktop)
qtChangeConsole Change the size of the console window
qtConSetConsoleWindowPosition Position the console window (relative to the desktop)
qtConGetPrimaryScreenSize Get the resolution of the primary screen
Cursor
qtConGetCursorPosition Get cursor's position
qtConSetCursorPosition Position cursor
qtConGetConsoleCursorSize Get size of the cursor
qtConSetConsoleCursorSize Set cursor's size (0 - 100)
Output
qtConGetTextColor Get active color (used for output)
qtConSetTextColor   Set active color (for subsequent output)
qtConConvertToColorValue Convert color code into an integer value
qtConWrite Output text, optionally position
qtConClearConsole Clear the console
Other Functions
qtConSetConsoleWindowTitle   Change the title of the console window (caption)
qtConFlushConsoleInputBuffer Flush the console input buffer (clears READ buffer)
qtConGetErrorInformation Get the meaning of an error code

Scope of Supply

qtConsole consists of a static library (.lib) and several pre-compiled MODULE files (.mod). The functions and their usage is described in the manual (PDF), including examples and several illustrations.
To ease usage, a demonstration program (Ex01.f90) is provided, that demonstrates many essential functions. For all compiler systems that are supported (see below) ready-to-use projects are provided, that include the demo program and all the other files needed. So, after loading the project, a "Build" will create the demo program (Ex01.exe). Compare the "Instructions for Installation and First Usage" below.

 

Supported Compiler Systems

At present the following variants exist:

  • Compaq Visual Fortran v6.6
  • Intel Visual Fortran (Win32) v10.1 and higher
  • Silverfrost FTN95 (Win32) v5.5 and higher

It may be that compatible compilers can use qtConsole too. Try yourself using the evaluation version (see below). If you own a compiler that is not supported by qtConsole, but you would like to have a binding for this, let us know (mailto:sales@polyhedron.com). If there is sufficient demand, we will try to develop a version for your compiler.


Download

 

You can download an evaluation copy here which has a few functional limitation (1) including the manual (PDF (2); download size: about 1.6 MB):
qtConsole.zip or as self extracting archive
Install_qtConsole.exe

Instructions for Installation and First Usage:

  1. Create a directory on your PC (e.g. C:\qtConsole).
  2. Copy the file you have downloaded into this directory.
  3. Unzip this file into this directory.
  4. Then you are ready to start one of the files suitable to your development system: CVF\Ex01\Ex01.dsw, IVF\Ex01\Ex01.sln, or FTN95\Ex01\Ex01.ftn95p (a double click on the file symbol in Windows File Explorer should start-up your development environment), which create the demo program Ex01.exe.
  5. After this perform a "Build".
  6. The Ex01.exe should be built and you can run it.

(1) The evaluation copy allows the usage of all functions until the end of the year. When starting a program that calls qtConsole functions a message box pops up at the beginning which displays a message accordingly. On purchase of a qtConsole Licence you will receive a licence file, which activates the "full version", that can be used without limitation (no message box, no time limit).



Licensing

The evaluation copy is converted into a fully functioning version by purchase of a qtConsole licence (no re-installation necessary).
A qtConsole licence grants a single named user (the licensee) the usage of the qtConsole software (single user licence) for to create applications (.exe) that he/she may distribute freely. This means, there are no runtime fees or any other royalties to be paid additionally. The complete licence conditions are to be found in the manual.
The licence is supplied (QTCON.0010) by sending a licence file via email. The licence file contains the data the licensee specifies (name and address), the licence number, and the licence key.


System Requirements

To use the qtConsole software the following is needed

  • PC running Windows, hard disk with about 6 MB available.
  • One of the following operating systems: Microsoft Windows 2000, Windows 2003, Windows XP, Windows Vista, Windows 7.
  • A Fortran compiler system as supported (see above).