C語言的函數彙整
此資料僅供函數查詢用,正確用法請參閱C Bibile,或線上手冊。
數學運算函數
函數名稱  | 需引入的前端處理函數  | 用             途  | 
abs  | stdlib.h  | 取整數的絕對值  | 
acos  | math.h  | 計算反餘弦值。  | 
asin  | math.h  | 計算反正弦值。  | 
atan  | math.h  | 計算反正切值。  | 
atan2  | math.h  | 計算 y/x 的反正切值。  | 
atof  | stdlib.h  | 轉換字串為浮點型態數值。  | 
atoi  | stdlib.h  | 轉換字串為整數值。  | 
atol  | stdlib.h  | 轉換字串為長整數值。  | 
cabs  | math.h  | 計算複數的絕對值。  | 
ceil  | math.h  | 取得一個浮點數的極大值。  | 
cos  | math.h  | 計算餘弦值。  | 
cosh  | math.h  | 傳回雙曲線餘弦值。  | 
div  | stdlib.h  | 傳回兩數相除的商及餘數。  | 
ecvt  | stdlib.h  | 將浮點數轉換成字串。  | 
exp  | math.h  | 計換指數。  | 
fabs  | math.h  | 計算浮點數的絕對值。  | 
fcvt  | stdlib.h  | 將浮點數轉成字串。  | 
floor  | math.h  | 傳回浮點數的整數部份。  | 
fmod  | math.h  | 計算浮點數相除後的餘數。  | 
frexp  | math.h  | 分割浮點數為假數和指數兩部份。  | 
gcvt  | stdlib.h  | 轉換浮點數為字串。  | 
hypot  | math.h  | 計算三角形的斜邊長度。  | 
itoa  | stdlib.h  | 將數字轉成字串。  | 
labs  | stdlib.h  | 產生長整數n的絕對值。  | 
ldiv  | stdlib.h  | 傳回長整數相除的商及餘數。  | 
log  | math.h  | 計算對數值。  | 
log10  | math.h  | 計算對數值。  | 
ltoa  | stdlib.h  | 將長整數轉換為字串。  | 
matherr  | math.h  | 處理由數學函數所產生的錯誤。  | 
max  | stdlib.h  | 傳回兩數值中的較大值。  | 
min  | stdlib.h  | 傳回兩數值中的較三值。  | 
modf  | math.h  | 將浮點數分解為整數及小數兩部份。  | 
poly  | math.h  | 多項式函數。  | 
pow  | math.h  | 計算次方值。  | 
pow10  | math.h  | 計算十的次方。  | 
rand  | stdlib.h  | 產生一個虛擬隨機亂數。  | 
randomize  | stdlib.h  | 初始化亂數產生器。  | 
sin  | math.h  | 計算正弦值。  | 
sinh  | math.h  | 傳回雙曲線正弦值。  | 
sqrt  | math.h  | 計算平方根值。  | 
srand  | stdlib.h  | 設定隨機函數rand 的基數。  | 
strtod  | stdlib.h  | 將字串轉換為雙精度數值。  | 
tan  | math.h  | 計算正切數值。  | 
tanh  | math.h  | 傳回雙曲線正切數值。  | 
ultoa  | stdlib.h  | 將數字轉換成以空字元結尾的字元串。  | 
字元的分類函數
函數名稱  | 需引入的前端處理函數  | 用               途  | 
isalnum  | ctype.h  | 測試某一整數值是否為‘A’-‘Z’, ‘a’-‘z’, ‘0’-‘9’等文數字之一。  | 
isalpha  | ctype.h  | 測試某一整數值是否為’A’-‘Z’, ‘a’-‘z’, 等字母之一。  | 
isascii  | ctype.h  | 如果ch的值判於0-127,則傳回非零整數(0x00-0x7F)。  | 
iscntrl  | ctype.h  | 如果ch是一刪除字元或一般控制字元,則傳回非零整數(0x7F或0x00-0x1F)。  | 
isdigit  | ctype.h  | 如果ch是一數字,則傳回非零整數。  | 
isgraph  | ctype.h  | 如果ch是為可列印字元,則傳回非零整數。  | 
islower  | ctype.h  | ch若為小寫字母,則傳回非零整數。  | 
isprint  | ctype.h  | ch若為可列印字元,則傳回非零整數。其功能與isgraph相似。  | 
ispunct  | ctype.h  | ch若為標點符號,則傳回非零整數。  | 
isspace  | ctype.h  | ch若為空白字元或定位字元(Tab),歸位字元(Enter鍵),新列字元,垂直定位字元,換頁字元,則傳回非零整數。  | 
isupper  | ctype.h  | ch若為大寫字母,則傳回非零整數。  | 
isxdigit  | ctype.h  | ch若為一個十六進位數字,則傳回非零整數。  | 
字串處理函數
函數名稱  | 需引入的前端處理函數  | 用                途  | 
stpcpy  | string.h  | 將某一字串抄錄到另一字串中。  | 
strcat  | string.h  | 字串合併。  | 
strchr  | string.h  | 順向搜尋字元第一次出現的位址。  | 
strcmp  | string.h  | 比較兩字串間的關係,並傳回比較值。  | 
strcmpi  | string.h  | 不考慮字母之大小,比較兩字串。  | 
strcpy  | string.h  | 字串拷貝。  | 
strcspn  | string.h  | 找出字串中不含指定字元集之任何子集的第一段子字串。  | 
strdup  | string.h  | 將一字串抄錄到一個新產生的位置上。  | 
strerror  | string.h  | 傳回指向錯誤訊息字串的指標。  | 
stricmp  | string.h  | 不計大小寫之字串比較。  | 
strlen  | string.h  | 字串長度計算。  | 
strlwr  | string.h  | 大寫字母轉小寫。  | 
strncat  | string.h  | 字串合併。  | 
strncmp  | string.h  | 比較字串的某一部份和另一字串的某一部份是否相同。  | 
strncmpi  | string.h  | 不考慮字母的大小寫將一字串部份與另一字串部份作比較。  | 
strnicmp  | string.h  | 比較字串的前n個字元,不計字母之大小寫關係。  | 
strnset  | string.h  | 局部字串替換。  | 
strpbrk  | string.h  | 找出指定字元函數。  | 
strrchr  | string.h  | 反向搜尋字元第一次出現之位址。  | 
strrev  | string.h  | 反轉字串之字元。  | 
strset  | string.h  | 字串替換。  | 
strspn  | string.h  | 搜尋字串中段是一給定字元集之任何子集的子字串。  | 
strstr  | string.h  | 子字串搜尋函數。  | 
strtok  | string.h  | 搜尋字串的語法單元。  | 
strupr  | string.h  | 將小寫字母轉換為大寫。  | 
字元與字串轉換函數
函數名稱  | 需引入的前端處理函數  | 用             途  | 
atof  | stdlib.h  | 轉換字串為浮點數值。  | 
atoi  | stdlib.h  | 轉換字串為整數值。  | 
atol  | stdlib.h  | 轉換字串為長整數值。  | 
ecvt  | stdlib.h  | 轉換浮點數為字串。  | 
fcvt  | stdlib.h  | 轉換浮點數為字串。  | 
gcvt  | stdlib.h  | 轉換浮點數為字串。  | 
itoa  | stdlib.h  | 轉換整數為字串。  | 
ltoa  | stdlib.h  | 轉換長整數為字串。  | 
strtod  | stdlib.h  | 將字串轉換為雙精度值。  | 
strtol  | stdlib.h  | 將字串轉換為長整數。  | 
strtoul  | stdlib.h  | 將字串轉換為無負號的長整數。  | 
toascii  | ctype.h  | 將字元轉換成指定的格式。  | 
tolower  | ctype.h  | 將字元轉換成指字的格式。  | 
toupper  | ctype.h  | 將字元轉換成指字的格式。  | 
ultoa  | stdlib.h  | 將數字轉換成以空字元結尾的字串。  | 
_lrotl  | stdlib.h  | 向左旋轉一無正負號長整數值。  | 
_lrotr  | stdlib.h  | 向右旋轉一無正負號長整數值。  | 
_lrotr  | stdlib.h  | 向右旋轉一整數值。  | 
時間與日期函數
函數名稱  | 需引入的前端處理函數  | 用            途  | 
asctime  | time.h  | 產生時間字串。  | 
ctime  | time.h  | 把時間值轉換成字串。  | 
delay  | dos.h  | 暫停執行片刻。  | 
difftime  | time.h  | 計算兩時間差。  | 
getdate  | dos.h  | 取得MS-DOS的日期。  | 
gettime  | dos.h  | 取得MS-DOS的時間。  | 
gmtime  | time.h  | 將長整數時間轉換成格林治標準時間。  | 
localtime  | time.h  | 將格林治標準時間依時區調整為本地時間。  | 
setdate  | dos.h  | 設定系統日期。  | 
settime  | dos.h  | 設定系統時間。  | 
stime  | time.h  | 設定系統日期及時間。  | 
聲音函數
函數名稱  | 需引入的前端處理函數  | 用             途  | 
nsound  | dos.h  | 關閉嗶聲。  | 
sound  | dos.h  | 啟動PC的嗶聲。  | 
本文處理函數
函數名稱  | 需引入的前端處理函數  | 用             途  | 
clreol  | conio.h  | 在文字視窗內清除游標所在位置到最後一列的字元。  | 
clrscr  | conio.h  | 清除文字視窗。  | 
delline  | conio.h  | 刪除本文視窗中的一列資料。  | 
gettext  | conio.h  | 將本文視窗內文字資料存在記憶體內。  | 
gettextinfo  | conio.h  | 取得本文模式的螢幕資訊。  | 
gettextsettings  | conio.h  | 傳回有關本文視窗的相關資訊。  | 
gotoxy  | conio.h  | 變更游標的座標位置。  | 
higvideo  | conio.h  | 高亮度的字元顯示。  | 
insline  | conio.h  | 在本文視窗中插入空白列。  | 
lowvideo  | conio.h  | 低亮度的字元顯示。  | 
movetext  | conio.h  | 拷貝螢幕上一矩形本文到另一區域。  | 
normvideo  | conio.h  | 恢復正常字元亮度的顯示。  | 
puttext  | conio.h  | 從記憶體中拷貝本文資料回螢幕上。  | 
textattr  | conio.h  | 設定本文的屬性。  | 
textbackground  | conio.h  | 設定背景顏色。  | 
textcolor  | conio.h  | 前景屬性設定。  | 
textmode  | conio.h  | 將螢幕設定在本文模式底下。  | 
wherex  | conio.h  | 傳回本文視窗下水平游標位置。  | 
wherey  | conio.h  | 傳回本文視窗下垂直游標位置。  | 
window  | conio.h  | 定義文字模式視窗。  | 
輸出/輸入函數
函數名稱  | 需引入的前端處理函數  | 用            途  | 
cputs  | conio.h  | 顯示字串。  | 
cgets  | conio.h  | 由控制台讀取一字串。  | 
eof  | io.h  | 偵查檔案終了。  | 
fopen  | stdio.h  | 開啟緩衝式的檔案。  | 
fclose  | stdio.h  | 關閉某一開啟之檔案。  | 
fcloseall  | stdio.h  | 關閉所有開啟之檔案。  | 
fgetc  | stdio.h  | 讀取字元。  | 
fgetchar  | stdio.h  | 從標準輸入stdin中讀取字元。  | 
fgetpos  | stdio.h  | 取得檔案指標。  | 
fgets  | stdio.h  | 讀取字串。  | 
filelength  | io.h  | 傳回檔案的長度。  | 
fprintf  | stdio.h  | 將格式化資料輸出到檔案中。  | 
fputc  | stdio.h  | 輸出字元到某一管道中。  | 
fputs  | stdio.h  | 輸出字串到某一管道中。  | 
fscanf  | stdio.h  | 由檔案中讀取格式化的資料。  | 
getc  | stdio.h  | 讀取字元。  | 
getch  | conio.h  | 讀取字元。  | 
getchar  | stdio.h  | 讀取字元。  | 
getche  | conio.h  | 讀取字元。  | 
gets  | stdio.h  | 讀取字串。  | 
scanf  | stdio.h  | 格式化輸入。  | 
printf  | stdio.h  | 格式化輸出。  | 
read  | io.h  | 讀取檔案資料。  | 
write  | io.h  | 將資料寫入檔案中。  | 
fread  | stdio.h  | 從管道中讀取資料。  | 
fwrite  | stdio.h  | 將資料寫到輸出管道中。  | 
puts  | stdio.h  | 輸出字串。  | 
putc  | stdio.h  | 輸出字元。  | 
putch  | conio.h  | 輸出字元。  | 
putchar  | stdio.h  | 輸出字元。  | 
繪圖函數
函數名稱  | 需引入的前端處理函數  | 用            途  | 
getmaxx(void)  | graphics.h  | 偵測螢幕最大水平座標  | 
getmaxy(void)  | graphics.h  | 偵測螢幕最大垂直座標  | 
line(x1,y1,x2,y2)  | graphics.h  | 繪製兩點直線  | 
lineto(x,y)  | graphics.h  | 由此點繪至另一點直線  | 
circle(x,y,radius)  | graphics.h  | 畫圓  | 
ellipse(xc,yc,stangle,endangle,xr,yr)  | graphics.h  | 畫橢圓  | 
arc(xc,yc,stangle,endangle,radius)  | graphics.h  | 畫狐  | 
rectangle(left,top,right,bottom)  | graphics.h  | 畫長方形  | 
drawpoly(number,dataarray)  | graphics.h  | 畫多邊形  | 
fillpoly(number,datalist)  | graphics.h  | 多邊形塗實心色  | 
floodfill(x,y,border)  | graphics.h  | 將某封閉區間填滿  | 
fillellipse(xc,yc,xr,yr)  | graphics.h  | 塗滿橢圓區間  | 
setcolor(color)  | graphics.h  | 設定前景色  | 
setbkcolor(color)  | graphics.h  | 設定背景色  | 
setfillstyle(patter,color)  | graphics.h  | 設定塗滿樣式。  | 
setlinestyle(style,pattern,thickness)  | graphics.h  | 設定線條樣式。  | 
bar(left, top, right, bottom)  | graphics.h  | 繪製平面長條圖  | 
bar3d(left, top, right, bottom, depth, topflag)  | graphics.h  | 繪製立體長條圖  | 
putpixel(x, y, color)  | graphics.h  | 點繪圖  | 
getpixel(x, y)  | graphics.h  | 獲取螢幕上一點的顏色  | 
 引用 來源
Tags:
C語言