unix c函数大全.docVIP

  • 10
  • 0
  • 约5.05万字
  • 约 61页
  • 2017-12-04 发布于江西
  • 举报
unix c函数大全

UNIX环境C函数大全 UNIX环境C函数大全 函数名: abort 功 能: 异常终止一个进程 用 法: void abort(void); 程序例: #include stdio.h #include stdlib.h int main(void) { printf(Calling abort()n); abort(); return 0; /* This is never reached */ } 函数名: abs 功 能: 求整数的绝对值 用 法: int abs(int i); 程序例: #include stdio.h #include math.h int main(void) { int number = -1234; printf(number: %d absolute value: %dn, number, abs(number)); return 0; } 函数名: access 功 能: 确定文件的访问权限 用 法: int access(const char *filename, int amode); 程序例: #include stdio.h #include io.h int file_exists(char *filename); int main(void) { printf(Does NOTEXIST.FIL exist: %sn, file_exists(NOTEXISTS.FIL) ? YES : NO); return 0; } int file_exists(char *filename) { return (access(filename, 0) == 0); } 函数名: acos 功 能: 反余弦函数 用 法: double acos(double x); 程序例: #include stdio.h #include math.h int main(void) { double result; double x = 0.5; result = acos(x); printf(The arc cosine of %lf is %lfn, x, result); return 0; } 函数名: asctime 功 能: 转换日期和时间为ASCII码 用 法: char *asctime(const struct tm *tblock); 程序例: #include stdio.h #include string.h #include time.h int main(void) { struct tm t; char str[80]; /* sample loading of tm structure */ t.tm_sec = 1; /* Seconds */ t.tm_min = 30; /* Minutes */ t.tm_hour = 9; /* Hour */ t.tm_mday = 22; /* Day of the Month */ t.tm_mon = 11; /* Month */ t.tm_year = 56; /* Year - does not include century */ t.tm_wday = 4; /* Day of the week */ t.tm_yday = 0; /* Does not show in asctime */ t.tm_isdst = 0; /* Is Daylight SavTime; does not show in asctime */ /* converts structure to null terminated string */ strcpy(str, asctime(t)); printf(%sn, str); return 0; } ? 函数名: asin 功 能: 反正弦函数 用 法: double asin(double x); 程序例: #include stdio.h #include math.h int main(void) { double result; double x = 0.5; result = asin(x); printf(The arc sin of %lf is %lfn, x, result); return(0); } ? 函数名: assert 功 能: 测试一个条件并可能使程序终止 用 法: void assert(int test); 程序例: #

文档评论(0)

1亿VIP精品文档

相关文档