C語言函式用法大全

2021-03-03 23:41:52 字數 1817 閱讀 6752

函式名: stpcpy

功能: 拷貝乙個字串到另乙個

用法: char *stpcpy(char *destin, char *source);

程式例:

#include

#include

int main(void)

函式名: strcat

功能: 字串拼接函式

用法: char *strcat(char *destin, char *source);

程式例:

#include

#include

int main(void)

函式名: strchr

功能: 在乙個串中查詢給定字元的第乙個匹配之處\

用法: char *strchr(char *str, char c);

程式例:

#include

#include

int main(void)

函式名: strcmp

功能: 串比較

用法: int strcmp(char *str1, char *str2);

看asic碼,str1>str2,返回值 > 0;兩串相等,返回0

程式例:

#include

#include

int main(void)

函式名: strncmpi

功能: 將乙個串中的一部分與另乙個串比較, 不管大小寫

用法: int strncmpi(char *str1, char *str2, unsigned maxlen);

程式例:

#include

#include

int main(void)

函式名: strcpy

功能: 串拷貝

用法: char *strcpy(char *str1, char *str2);

程式例:

#include

#include

int main(void)

函式名: strcspn

功能: 在串中查詢第乙個給定字符集內容的段

用法: int strcspn(char *str1, char *str2);

程式例:

#include

#include

#include

int main(void)

函式名: strdup

功能: 將串拷貝到新建的位置處

用法: char *strdup(char *str);

程式例:

#include

#include

#include

int main(void)

函式名: stricmp

功能: 以大小寫不敏感方式比較兩個串

用法: int stricmp(char *str1, char *str2);

程式例:

#include

#include

int main(void)

函式名: strerror

功能: 返回指向錯誤資訊字串的指標

用法: char *strerror(int errnum);

程式例:

#include

#include

int main(void)

函式名: strcmpi

功能: 將乙個串與另乙個比較, 不管大小寫

用法: int strcmpi(char *str1, char *str2);

程式例:

#include

#include

int main(void)

C語言函式大全

函式名 abort 功能 異常終止乙個程序 用法 void abort void 函式名 abs 功能 求整數的絕對值 用法 int abs int i 函式名 absread,abswirte 功能 絕對磁碟扇區讀 寫資料 用法 int absread int drive,int nsects,i...

C語言庫函式大全

absread 讀磁碟絕對扇區函式 原形 int absread int drive,int num,int sectnum,void buf 功能 從drive指定的驅動器磁碟上,sectnum指定的邏輯扇區號開始讀取 通過dos中斷0x25讀取 num個 最多64k個 扇區的內容,儲存於buf所...

C語言字串函式大全

函式名 stpcpy 功能 拷貝乙個字串到另乙個 用法 char stpcpy char destin,char source 程式例 include include int main void 函式名 strcat 功能 字串拼接函式 用法 char strcat char destin,char...