资源预览内容
第1页 / 共12页
第2页 / 共12页
第3页 / 共12页
第4页 / 共12页
第5页 / 共12页
第6页 / 共12页
第7页 / 共12页
第8页 / 共12页
第9页 / 共12页
第10页 / 共12页
亲,该文档总共12页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
C 语言库函数(G 类字母) - 2本文出自:http:/www.asfocus.com 作者: (2001-07-28 08:05:00)函数名: getdate 功 能: 取 DOS 日期 用 法: void getdate(struct *dateblk); 程序例: #include #include int main(void) struct date d; getdate( printf(The current year is: %dn, d.da_year); printf(The current day is: %dn, d.da_day); printf(The current month is: %dn, d.da_mon); return 0; 函数名: getdefaultpalette 功 能: 返回调色板定义结构 用 法: struct palettetype *far getdefaultpalette(void); 程序例: #include #include #include #include int main(void) /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int i; /* structure for returning palette copy */ struct palettetype far *pal=(void *) 0; /* initialize graphics and local variables */ initgraph( /* read result of initialization */ errorcode = graphresult(); /* an error occurred */ if (errorcode != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch(); /* terminate with an error code */ exit(1); setcolor(getmaxcolor(); /* return a pointer to the default palette */ pal = getdefaultpalette(); for (i=0; icolorsi); getch(); /* clean up */ getch(); closegraph(); return 0; 函数名: getdisk 功 能: 取当前磁盘驱动器号 用 法: int getdisk(void); 程序例: #include #include int main(void) int disk; disk = getdisk() + A; printf(The current drive is: %cn, disk); return 0; 函数名: getdrivername 功 能: 返回指向包含当前图形驱动程序名字的字符串指针 用 法: char *getdrivename(void); 程序例: #include #include #include #include int main(void) /* request auto detection */ int gdriver = DETECT, gmode, errorcode; /* stores the device driver name */ char *drivername; /* initialize graphics and local variables */ initgraph( /* read result of initialization */ errorcode = graphresult(); /* an error occurred */ if (errorcode != grOk) printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch(); /* terminate with an error code */ exit(1); setcolor(getmaxcolor(); /* get name of the device driver in use */ drivername = getdrivername(); /* for centering text on the screen */ settextjustify(CENTER_TEXT, CENTER_TEXT); /* output the name of the driver */ outtextxy(getmaxx() / 2, getmaxy() / 2, drivername); /* clean up */ getch(); closegraph(); return 0; 函数名: getdta 功 能: 取磁盘传输地址 用 法: char far *getdta(void); 程序例: #include #include int main(void) char far *dta; dta = getdta(); printf(The current disk transfer address is: %Fpn, dta); return 0; 函数名: getenv 功 能: 从环境中取字符串 用 法: char *getenv(char *envvar); 程序例: #include #include int main(void) char *s; s=getenv(COMSPEC); /* get the comspec environment parameter */ printf(Command processor: %sn,s); /* display comspec parameter */ return 0; 函数名: getfat, getfatd 功 能: 取文件分配表信息 用 法: void getfat(int drive, struct fatinfo *fatblkp); 程序例: #include #include int main(void) struct fatinfo diskinfo; int flag = 0; printf(Please insert disk in drive An); getchar(); getfat(1, /* get drive information */ printf(nDrive A: is ); switch(unsigned char) diskinfo.fi_fatid) case 0xFD: printf(360K low densityn); break; case 0xF9: printf(1.2 Meg high densityn); break; default: printf(unformattedn); flag = 1; if (!flag) printf( sectors per cluster %5dn, diskinfo.fi_sclus); printf( number of clusters %5dn, diskinfo.fi_nclus); printf( bytes per sector %5dn, diskinfo.fi_bysec); return 0; 函数名: getfillpattern 功 能: 将用户定义的填充模式拷贝到内存中 用 法: void far getfillpattern(char far *upattern); 程序例: #include #include #include #include int main(void) /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int maxx, maxy; char pattern8 = 0x00, 0x70, 0x20, 0x27, 0x25, 0x27, 0x04, 0x04; /* initialize graphics and local variables */ initgraph( /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ printf(Graphics error: %sn, grapherrormsg(errorcode); printf(Press any key to halt:); getch(); exit(1); /* terminate with an error code */ maxx = getmaxx(); maxy = getmaxy(); setcolor(getmaxcolor(); /* select a user defined fill pattern */ setfillpattern(pattern, getmaxcolor(); /* fill the screen with the pattern */ bar(0, 0, maxx, maxy); getch(); /* get the current user defined fill pattern */ getfillpattern(pattern); /* alter the pattern we grabbed */ pattern4 -= 1; pattern5 -= 3; pattern6 += 3; pattern7 -= 4; /* select our new pattern */ setfillpattern(pattern, getmaxcolor(); /* fill the screen with the new pattern */ bar(0, 0, maxx, maxy); /* clean up */ getch(); closegraph(); return 0; 函数名: getfillsettings 功 能: 取得有关当前填充模式和填充颜色的信息 用 法: void far getfillsettings(struct fillsettingstype far *fillinfo); 程序例: #include #include #include #include / the names of the fill styles supported */ char *fname = EMPTY_FILL, SOLID_FILL, LINE_FILL, LTSLASH_FILL, SLASH_FILL, BKSLASH_FILL, LTBKSLASH_FILL, HATCH_FILL, XHATCH_FILL, INTERLEAVE_FILL, WIDE_DO
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号