gettext
conio.h:インデックス への移動
ヘッダーファイル
conio.h
カテゴリ
コンソール入出力ルーチン
プロトタイプ
int gettext(int left, int top, int right, int bottom, void *destin);
説明
テキストモード画面からメモリへテキストをコピーします。
gettext は,left,top,right,bottom で定義される画面上のテキスト四角形の内容を destin が指すメモリ領域に格納します。
すべての座標は,ウィンドウの相対座標ではなく,絶対画面座標です。左上隅の座標は(1,1)です。gettext は,四角形の内容を左から右,上から下の順にメモリに読み取ります。
画面上の各位置に対して 2 バイトのメモリが必要です。第 1 バイトはセル内の文字,第 2 バイトはセルのビデオ属性です。幅 w 列,高さ h 行の四角形に必要な容量は,次の式で定義されます。
バイト数=(行数 h)×(列数 w)× 2
メモ: Win32 GUI アプリケーションでは,この関数を使用しないでください。
戻り値
gettext は,処理に成功すると,1 を返します。
エラーが発生した場合(たとえば,現在の画面モードの範囲外の座標を指定したために失敗した場合)は,0 を返します。
例
#include <conio.h>
char buffer[4096];
int main(void)
{
int i;
clrscr();
for (i = 0; i <= 20; i++)
cprintf("Line #%d\r\n", i);
gettext(1, 1, 80, 25, buffer);
gotoxy(1, 25);
cprintf("Press any key to clear screen...");
getch();
clrscr();
gotoxy(1, 25);
cprintf("Press any key to restore screen...");
getch();
puttext(1, 1, 80, 25, buffer);
gotoxy(1, 25);
cprintf("Press any key to quit...");
getch();
return 0;
}
移植性
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |