RAD Studio |  |

textmode

Header File

conio.h

Category

Console I/O Routines

Prototype

void textmode(int newmode);

Description

Puts screen in text mode.

Note: Do not use this function in Win32 GUI applications.
textmode selects a specific text mode.

You can give the text mode (the argument newmode) by using a symbolic constant from the enumeration type text_modes (defined in conio.h).

The most commonly used text_modes type constants and the modes they specify are given in the following table. Some additional values are defined in conio.h.

LASTMODE | Previous text mode
BW40 | Black and white, 40 columns
C40 | Color, 40 columns
BW80 | Black and white, 80 columns
C80 | Color, 80 columns
MONO | Monochrome, 80 columns
C4350 | EGA 43-line and VGA 50-line modes

When textmode is called, the current window is reset to the entire screen, and the current text attributes are reset to normal, corresponding to a call to normvideo.

Specifying LASTMODE to textmode causes the most recently selected text mode to be reselected.

textmode should be used only when the screen or window is in text mode (presumably to change to a different text mode). This is the only context in which textmode should be used. When the screen is in graphics mode, use restorecrtmode instead to escape temporarily to text mode.

Return Value

None.

Example

Copy Code

    #include <conio.h>
    int main(void)
    {
       textmode(BW40);
       cprintf("ABC");
       getch();
       textmode(C40);
       cprintf("ABC");
       getch();
       textmode(BW80);
       cprintf("ABC");
       getch();
       textmode(C80);
       cprintf("ABC");
       getch();
       textmode(MONO);
       cprintf("ABC");
       getch();
       return 0;
    }

Portability

POSIX | Win32 | ANSI C | ANSI C++
| + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!