What is a Console?

A console is a text mode interface connected right to the heart of 32-bit Windows.  If you double-click on the MS-DOS icon in Windows, the window that opens with the C:\> prompt is your text console.  In it, you can execute commands such as DIR, CLS, COPY, etc.  Additionally, you can run text mode applications such as XCOPY32.EXE and PING.EXE.  These programs are actually 32-bit Windows applications that use special calls to the Win32 API in order to display text inside the console window.

PB/CC eliminates the need for you to learn these special Win32 API calls in order to create console applications.  The whole process is handled for you when you use the PRINT, LOCATE, COLOR, CLS, and other statements in the PB/CC language.  This frees you to concentrate on the task at hand.

While not every application you write for Windows will need to be a console application, the console is ideally suited for many types of tasks.  For example, using STDIN LINE and STDOUT you can write a utility which takes input from a redirected file, processes it, and sends the output to the standard output device which can be redirected to a new file.  A prime example is the SORT.EXE utility that comes with DOS:

SORT < myfile.txt > sorted.txt

The text file "myfile.txt" is read, sorted, and written back to the file "sorted.txt".  By using standard input and output for file I/O, the SORT utility can easily be used by other programs which do not have native sorting capability.  Porting the SORT utility to a Windows console application gives it the ability to work with much larger files.

DOS programs are limited to available "real mode" memory, which is typically around 640 Kb (less than one Megabyte).  32-bit Windows applications, on the other hand, can access up to two Gigabytes of memory.  This is a significant difference.

I.S. and I.T. departments may find PB/CC particularly useful for porting existing DOS applications written in PB/DOS or QuickBasic into the Windows environment.  For example, the simple text interface of a DOS application allows data entry operators to quickly enter repetitive information such as telephone orders or inventory data.  When ported to a Windows GUI application, the response by the operating system is much slower and often requires additional steps involving a mouse to accomplish the same task.  Re-training employees to use the new software and the lower productivity can then raise costs significantly.

Quite often, accounting departments are willing to continue using older DOS programs in order to avoid these problems, even if it means not being able to add additional features such as Internet connectivity, and integration with fast database servers such as MS SQL and Oracle.  By porting your application to PB/CC, exactly the same user interface can be retained, and the new features can be added.

Besides the text console interface, PB/CC offers BASIC programmers complete access to the complete Win32 API, including the Winsock API for Internet access, and ODBC for accessing SQL and other database servers.  Win32 console applications also have a two Gigabyte flat memory address, so trying to fit everything into 640 Kb or 16 Megabytes of EMS memory is no longer required.  A string variable can be many Megabytes in size and the limitation of arrays is measured in Gigabytes instead of Kilobytes.


See Also

Writing Programs in PBCC

What is a Console?

Hello, World! Example

Creating Programs