- 1
- 0
- 约4.21万字
- 约 87页
- 2018-06-23 发布于浙江
- 举报
首页 | 文章 | 相册 | 收藏夹 | 留言
C语言库函数---unix常用系统调用---使用说明
C语言库函数---unix常用系统调用---使用说明
【说明】 ?????一共分为3个小节,1小节给定一个连接,该连接给了一些常用标准c的函数使用说明,但是不够全面。2小结按字母顺序排列,几乎覆盖了c中常用的函数,同时有些函数不在unix系统中支持了。3小节描述了unix系统中常用系统调用的使用说明。 1、【下面这个连接给出了一些c库的函数说明使用例程,但是不够全面,可以作为参考】 [url]/forum/clib/clib.html[/url] 2、【如下对C语言库函数按字母顺序描述,如果上面连接中找不到,可以到这里查找到,需要说明的是,有些函数在新的libc中已经不提供了,如果要查找unix系统常用系统调用函数使用说明,请到小节3查找】 [code:1:6 函数名:?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:?%d\n,?number,?abs(number));? return?0;? }? 函数名:?absread,?abswirte? 功?能:?绝对磁盘扇区读、写数据? 用?法:?int?absread(int?drive,?int?nsects,?int?sectno,?void?*buffer);? int?abswrite(int?drive,?int?nsects,?in?tsectno,?void?*buffer);? 程序例:? /*?absread?example?*/? #include?stdio.h? #include?conio.h? #include?process.h? #include?dos.h? int?main(void)? {? int?i,?strt,?ch_out,?sector;? char?buf[512];? printf(Insert?a?diskette?into?drive?A?and?press?any?key\n);? getch();? sector?=?0;? if?(absread(0,?1,?sector,?buf)?!=?0)? {? perror(Disk?problem);? exit(1);? }? printf(Read?OK\n);? strt?=?3;? for?(i=0;?i80;?i++)? {? ch_out?=?buf[strt+i];? putchar(ch_out);? }? printf(\n);? 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:?%s\n,? 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(vo
您可能关注的文档
最近下载
- 推进教育、科技、人才一体化发行动计划.docx
- 24J306国家建筑标准设计图集.docx
- 沟通的力量:护理人文案例集锦.pptx VIP
- 2023-2024学年安徽省宣城市七年级(上)期末语文试卷(含详细答案解析).docx VIP
- 护理人文关怀实践案例与反思.docx VIP
- 《大学物理》2024-2025学年第一学期期末试卷及答案.docx VIP
- 橡胶和塑料制品加工系统粉尘防爆安全规范.docx VIP
- AQ_4232-2013 塑料生产系统粉尘防爆规范.pdf VIP
- 2024年江苏中职职教高考文化统考语文试卷真题(含答案详解).docx VIP
- GB50469-2016 橡胶工厂环境保护设计规范.pdf VIP
原创力文档

文档评论(0)