首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> 關於C語言

C語言函數速查手冊(一):A-B 字母開頭函數完整參考

     編輯:關於C語言

abort - 異常終止程序


void abort(void);
// 立即終止,不呼叫 atexit/清理函數,產生核心傾印 (視 OS 而定)

abs / labs / llabs - 整數絕對值


int abs(int n);
long labs(long n);
long long llabs(long long n);  // C99
// 注意:abs(INT_MIN) 未定義行為 (二補數無法表示對應正值)

absread / abswrite - 絕對磁區讀寫 (DOS 專用)


int absread(int drive, int nsects, int lsect, void *buffer);
int abswrite(int drive, int nsects, int lsect, const void *buffer);
// 僅限即時模式 DOS,現代 OS 禁止使用者模式直接磁區存取

access - 檢查檔案存取權限


int access(const char *pathname, int mode);
// mode: F_OK(存在), R_OK(可讀), W_OK(可寫), X_OK(可執行)
// 回傳 0 成功,-1 失敗;競態條件風險,實際開檔才可靠

acos / asin / atan / atan2 - 反三角函數


double acos(double x);   // 定義域 [-1,1],值域 [0,π]
double asin(double x);   // 定義域 [-1,1],值域 [-π/2,π/2]
double atan(double x);   // 值域 (-π/2,π/2)
double atan2(double y, double x); // 完整象限 [-π,π],處理 x=0
// 全屬 ANSI C 標準數學庫,需連結 -lm

allocmem - DOS 記憶體區塊配置


int allocmem(unsigned size, unsigned *segp);
// size 以段落為單位 (16 bytes);失敗回傳可用最大段落數
// 僅限即時模式 DOS

arc - BGI 繪製圓弧


void far arc(int x, int y, int stangle, int endangle, int radius);
// 角度單位:度,0 度在 3 點鐘方向,逆時針

asctime / ctime - 時間轉字串


char *asctime(const struct tm *tmptr);
char *ctime(const time_t *timer);
// 回傳靜態緩衝區,格式固定 "Wed Jun 30 21:49:08 1993\n\0"
// 非執行緒安全,現代請用 strftime

assert - 斷言除錯


void assert(int expression);
// NDEBUG 定義時編譯移除;僅用於除錯,不可作為錯誤處理

atexit - 登錄程序結束處理函數


int atexit(void (*func)(void));
// 可登錄多個,LIFO 順序執行;標準 C 支援

atof / atoi / atol / atoll - 字串轉數值


double atof(const char *nptr);
int atoi(const char *nptr);
long atol(const char *nptr);
long long atoll(const char *nptr); // C99
// 無錯誤回報,輸入無效回傳 0;嚴肅用途請用 strtod/strtol

bar / bar3d - BGI 繪製長條圖


void far bar(int left, int top, int right, int bottom);
void far bar3d(int left, int top, int right, int bottom,
               int depth, int topflag);
// 填滿矩形區域;配合 setfillstyle 設定填充樣式

標準化快速查核

函數標準備註
abort, abs, labs, atexit, atof, atoi, atolANSI C全平台可用
absread, abswrite, allocmemDOS 實模式現代 OS 不支援
access, acos, asin, atan, atan2POSIX / ANSI C跨平台可用
arc, asctime, bar, bar3dBorland BGI / 旧標準asctime 非執行緒安全
assertANSI C除錯專用
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved