資源簡介
腦動力:C語言函數速查效率手冊 光盤
韓先鋒
電子工業出版社
本書全面、系統地介紹了C語言的庫函數。C語言是基礎的通用程序設計語言,許多語言都是從C語言基礎上發展起來的,C語言庫函數可以使編程更加高效便捷,所以應該盡可能多地使用庫函數。書中的每個章節都有相應的實例解析,每個實例都具有代表性,在實際應用和開發中有很高的價值。
本書按照函數的功能分章編寫,共15章,分別介紹了C語言基礎、分類函數、字符串操作函數、輸入/輸出函數、數學函數、時間函數、轉換函數、圖形函數、診斷函數、接口函數、目錄函數、進程函數和內存函數。
本書附帶1張光盤,內容為本書中的所有例子、源代碼,方便讀者使用。

代碼片段和文件信息
/*函數gettextsettings示例?運行于TurboC下*/
#include?
#include?
#include?
#include?
/*?文字類型名字*/
char?*font[]?=?{?“DEFAULT_FONT“
?????????????????“TRIPLEX_FONT“
?????????????????“SMALL_FONT“
?????????????????“SANS_SERIF_FONT“
?????????????????“GOTHIC_FONT“
???????????????};
/*?the?names?of?the?text?directions?supported?*/
char?*dir[]?=?{?“HORIZ_DIR“?“VERT_DIR“?};
/*?horizontal?text?justifications?supported?*/
char?*hjust[]?=?{?“LEFT_TEXT“?“CENTER_TEXT“?“RIGHT_TEXT“?};
/*?vertical?text?justifications?supported?*/
char?*vjust[]?=?{?“BOTTOM_TEXT“?“CENTER_TEXT“?“TOP_TEXT“?};
void?save_pic(char*?fn);
int?main(void)
{
???/*?request?auto?detection?*/
???int?gdriver?=?DETECT?gmode?errorcode;
???struct?textsettingstype?textinfo;
???int?midx?midy?ht;
???char?fontstr[80]?dirstr[80]?sizestr[80];
???char?hjuststr[80]?vjuststr[80];
???/*?初始化圖形顯示系統*/
???initgraph(&gdriver?&gmode?““);
???/*?讀取初始化結果?*/
???errorcode?=?graphresult();
???if?(errorcode?!=?grOk)??/*?如果有錯誤發生*/
???{
??????printf(“Graphics?error:?%s\n“?grapherrormsg(errorcode));
??????printf(“Press?any?key?to?halt:“);
??????getch();
??????exit(1);?/*?異常退出*/
???}
???midx?=?getmaxx()?/?2;
???midy?=?getmaxy()?/?2;
???/*?獲取當前圖形文本設置信息?*/
???gettextsettings(&textinfo);
???/*?轉換文本信息為字符串形式?*/
???sprintf(fontstr?“%s?is?the?text?style.“?font[textinfo.font]);
???sprintf(dirstr?“%s?is?the?text?direction.“?dir[textinfo.direction]);
???sprintf(sizestr?“%d?is?the?text?size.“?textinfo.charsize);
???sprintf(hjuststr?“%s?is?the?horizontal?justification.“
???????????hjust[textinfo.horiz]);
???sprintf(vjuststr?“%s?is?the?vertical?justification.“
???????????vjust[textinfo.vert]);
???/*?顯示信息?*/
???ht?=?textheight(“W“);
???settextjustify(CENTER_TEXT?CENTER_TEXT);
???outtextxy(midx?midy?fontstr);
???outtextxy(midx?midy+2*ht?dirstr);
???outtextxy(midx?midy+4*ht?sizestr);
???outtextxy(midx?midy+6*ht?hjuststr);
???outtextxy(midx?midy+8*ht?vjuststr);
???/*?clean?up?*/
???save_pic(“my.bmp“);
???getch();
???closegraph();
???return?0;
}
void?save_pic(char?*fn)
{
typedef?long?LONG;
typedef?unsigned?char?BYTE;
typedef?unsigned?long?DWORD;
typedef?unsigned?short?WORD;
typedef?struct?tagBITMAPFILEHEADER?
{
????????WORD????bfType;
????????DWORD???bfSize;
????????WORD????bfReserved1;
????????WORD????bfReserved2;
????????DWORD???bfOffBits;
}?BITMAPFILEHEADER;
typedef?struct?tagBITMAPINFOHEADER
{
????????DWORD??????biSize;
????????LONG???????biWidth;
????????LONG???????biHeight;
????????WORD???????biPlanes;
????????WORD???????biBitCount;
????????DWORD??????biCompression;
????????DWORD??????biSizeImage;
????????LONG???????biXPelsPerMeter;
????????LONG???????biYPelsPerMeter;
????????DWORD??????biClrUsed;
????????DWORD??????biClrImportant;
}?BITMAPINFOHEADER;
????????int?ij;
????????FILE?*fp;
????????BITMAPFILEHEADER?bfh;
????????BITMAPINFOHEA
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2013-04-18?18:01??腦動力_C語言函數速查效率手冊
?????文件???????4341??2011-11-22?05:32??代碼文件\10\第一節?字體函數\gettextsettings_example.c
?????文件????????268??2011-11-22?22:42??代碼文件\10\第一節?字體函數\highvideo_example.c
?????文件????????267??2011-11-22?22:35??代碼文件\10\第一節?字體函數\lowvideo_example.c
?????文件???????2943??2011-11-22?19:13??代碼文件\10\第一節?字體函數\outtextxy_example.c
?????文件???????3048??2011-11-22?17:45??代碼文件\10\第一節?字體函數\outtext_example.c
?????文件???????3811??2011-11-22?19:35??代碼文件\10\第一節?字體函數\settextjustify_example.c
?????文件???????3503??2011-11-22?04:09??代碼文件\10\第一節?字體函數\settextst
?????文件???????3586??2011-11-22?23:37??代碼文件\10\第一節?字體函數\setusercharsize_example.c
?????文件???????3165??2011-11-22?21:58??代碼文件\10\第一節?字體函數\textheight_example.c
?????文件???????3162??2011-11-22?22:10??代碼文件\10\第一節?字體函數\textwidtht_example.c
?????文件???????3116??2011-11-23?06:05??代碼文件\10\第二節?其它函數集合\bar3d_example.c
?????文件???????3107??2011-11-23?05:57??代碼文件\10\第二節?其它函數集合\bar_example.c
?????文件???????3207??2011-11-23?01:31??代碼文件\10\第二節?其它函數集合\cleardevice_example.c
?????文件???????3342??2011-11-23?00:49??代碼文件\10\第二節?其它函數集合\clearviewport_example.c
?????文件???????2998??2011-11-23?06:15??代碼文件\10\第二節?其它函數集合\closegraph_example.c
?????文件???????1036??2011-11-22?23:35??代碼文件\10\第二節?其它函數集合\detectgraph_example.c
?????文件????????839??2012-02-21?23:33??代碼文件\10\第二節?其它函數集合\getgraphmode_example.c
?????文件???????3553??2011-11-23?18:51??代碼文件\10\第二節?其它函數集合\getimage_example.c
?????文件???????3198??2011-11-23?04:49??代碼文件\10\第二節?其它函數集合\getmaxx_example.c
?????文件???????3198??2011-11-23?05:31??代碼文件\10\第二節?其它函數集合\getmaxy_example.c
?????文件???????3317??2011-11-23?06:47??代碼文件\10\第二節?其它函數集合\getmodename_example.c
?????文件???????3165??2011-11-23?18:58??代碼文件\10\第二節?其它函數集合\getmoderange_example.c
?????文件???????3569??2011-11-22?23:54??代碼文件\10\第二節?其它函數集合\getviewsetting_example.c
?????文件???????2994??2011-11-23?00:26??代碼文件\10\第二節?其它函數集合\getx_example.c
?????文件???????2994??2011-11-23?00:37??代碼文件\10\第二節?其它函數集合\gety_example.c
?????文件???????3259??2011-11-23?19:25??代碼文件\10\第二節?其它函數集合\graphdefaults_example.c
?????文件???????2853??2011-11-23?22:41??代碼文件\10\第二節?其它函數集合\grapherrormsg_example.c
?????文件???????2856??2011-11-23?22:34??代碼文件\10\第二節?其它函數集合\graphresult_example.c
?????文件???????3021??2011-11-22?23:05??代碼文件\10\第二節?其它函數集合\initgraph_example.c
............此處省略368個文件信息
評論
共有 條評論