Language:
Fortran
Dialect:
SilverFrost F95, Personal Edition
Discussion:
SilverFrost F95 PE is about the best free Fortran compiler you can find on the internet. It comes with its own IDE and is a powerful and effective programming language. Unfortunately, although geared mostly to producing console apps, it has no native routines for clearing the screen or setting the text cursor position. I therefore wrote a routine for the latter which works by calling the Windows API SetConsoleCursorPosition routine.
! Locate does the Windows-API-related work of moving the text cursor.
Subroutine Locate(Row, Col)
integer :: Row ! On screen, 0-24.
integer :: Col ! On screen, 0-79.
integer :: Coord ! Composite value of row and column.
integer :: HandleForConsole ! From GetStdHandle routine.
include 'win32api.ins' ! Routines.
include 'win32prm.ins' ! Constants.
Coord = 65536 * Row + Col ! Jam both values into 1 integer.
HandleForConsole = GetStdHandle(STD_OUTPUT_HANDLE)
Call SetConsoleCursorPosition(HandleForConsole, Coord) ! Go!
End Subroutine Locate
| Page created: | 06/14/2013 |
| Last modified: | 06/14/2013 |
| Author: | BPL |