基本介紹
- 中文名:_graphfreemem
- 功 能::可修改的圖形存儲區釋放函式
- 用 法::void far _graphfreemem
- 程式例:#include <graphics.h>
基本信息,程式舉例,
基本信息
函式名: _graphfreemem
功 能: 用戶可修改的圖形存儲區釋放函式
用 法: void far _graphfreemem(void far *ptr, unsigned size);
程式舉例
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
/* clear the text screen */
clrscr();
printf("Press any key to initialize graphics mode:");
getch();
clrscr();
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "");
/* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* display a message */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy, "Press any key to exit graphics mode:");
/* clean up */
getch();
closegraph();
return 0;
}
/* called by the graphics kernel to allocate memory */
void far * far _graphgetmem(unsigned size)