在没有IDE的时候,记住一些常用的库函数的函数名、参数、基本用法及注意事项是很有必要的。

参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类:

  • 1. 内存及字符串控制及操作
  • 2. 字符串转换
  • 3. 字符测试
  • 4. 文件操作
  • 5. 时间日期
  • 6. 常用数学函数
  • 7. 文件内容操作
  • 8. 文件权限控制
  • 9. 进程操作
  • 10. 线程操作
  • 11. Socket操作
  • 12. 信号处理
  • 13. 数据结构及算法

以下是对第一项 内存及字符串控制及操作 的归纳整理。

  • 已经不赞成使用的函数归类
*
* 函数名 用途 替换方案
*. int bcmp(const void *s1, const void *s2, size_t n); compare byte sequences memcmp
*
*. void bcopy(const void *src, void *dest, size_t n); copy byte sequence memcpy Or memmove
*
*. void bzero(void *s, size_t n); write zero-valued bytes memset
*
*. char *index(const char *s, int c); locate character in string strchr
*
*. char *rindex(const char *s, int c); locate character in string strrchr
*
  • 内存或字符串查找函数归类
*           函数名                                                   用途                                       备注
*. void *memchr(const void *s, int c, size_t n); scan memory for a character (Forward) return a pointer to the matching byte or NULL if the
character does not occur in the given memory area.
*
*. void *memrchr(const void *s, int c, size_t n); scan memory for a character (Backward) return a pointer to the matching byte or NULL if the
character does not occur in the given memory area.
*
*. char *strchr(const char *s, int c); locate character in string (Forward) return a pointer to the matched character or NULL if
the character is not found.
*
*. char *strrchr(const char *s, int c); locate character in string (Backward) return a pointer to the matched character or NULL if
the character is not found.
*
*. char *strstr(const char *haystack, const char *needle); locate a substring return a pointer to the beginning of the substring,
or NULL if the substring is not found.
*
*. char *strcasestr(const char *haystack, const char *needle); locate a substring,ignores the return a pointer to the beginning of the substring,
case of both arguments. or NULL if the substring is not found.
*
  • 内存及字符串拷贝、比较函数归类
*           函数名                                                  用途                                        备注
*
*. void *memcpy(void *dest, const void *src, size_t n); copy memory area The memcpy() function returns a pointer to dest.
*
*. char *strcpy(char *dest, const char *src); copy a string return a pointer to the destination string dest.
*
*. char *strncpy(char *dest, const char *src, size_t n); copy a string return a pointer to the destination string dest.
*
*. void *memmove(void *dest, const void *src, size_t n); copy memory area , may overlap returns a pointer to dest.
*
*. int memcmp(const void *s1, const void *s2, size_t n); compare memory areas returns an integer less than, equal to, or greater than zero if the first n bytes of s1 is found
*
*. int strcmp(const char *s1, const char *s2); compare two strings return an integer less than, equal to, or greater than zero if s1 is foundfound
*
*. int strncmp(const char *s1, const char *s2, size_t n); compare two strings UP
*
*. int strcasecmp(const char *s1, const char *s2); compare two strings ignoring case UP
*
*. int strncasecmp(const char *s1, const char *s2, size_t n); compare two strings ignoring case UP
*
* . char *strdup(const char *s); duplicate a string returns a pointer to a new string which is a duplicate of the string s. Memory for the new string is obtained with
*
  • 内存或字符串连接、分割、求长等函数归类
*           函数名                                                  用途                                            备注
*. char *strcat(char *dest, const char *src); concatenate two strings return a pointer to the resulting string dest
*
*. char *strncat(char *dest, const char *src, size_t n); UP UP
*
*. char *strtok(char *str, const char *delim); extract tokens from strings 第一次调用时,str必须不为空,第二次调用str必须为空
*
*. char *strtok_r(char *str, const char *delim, char **saveptr); 可重入函数,线程安全 推荐使用这个分割函数,具体讨论见http://blog.csdn.net/liuintermilan/article/details/6283705
*

以上,就是对第一项的整理归纳。接下来,会对第二项 字符串转换  进行归纳。

归纳整理Linux下C语言常用的库函数----内存及字符串控制及操作的更多相关文章

  1. 归纳整理Linux下C语言常用的库函数----文件操作

    在没有IDE的时候,记住一些常用的库函数的函数名.参数.基本用法及注意事项是很有必要的. 参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类: 1. 内存及字符串控制及操作 2. ...

  2. 归纳整理Linux下C语言常用的库函数----时间日期数学及算法

    在没有IDE的时候,记住一些常用的库函数的函数名.参数.基本用法及注意事项是很有必要的. 参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类: 1. 内存及字符串控制及操作 2. ...

  3. 归纳整理Linux下C语言常用的库函数----字符串转换、字符测试、及内存控制

    在没有IDE的时候,记住一些常用的库函数的函数名.参数.基本用法及注意事项是很有必要的. 参照Linux_C_HS.chm的目录,我大致将常用的函数分为一下几类: 1. 内存及字符串控制及操作 2. ...

  4. 笔记整理——Linux下C语言正则表达式

    Linux下C语言正则表达式使用详解 - Google Chrome (2013/5/2 16:40:37) Linux下C语言正则表达式使用详解 2012年6月6日Neal627 views发表评论 ...

  5. LINUX下C语言编程基础

    实验二 Linux下C语言编程基础 一.实验目的 1. 熟悉Linux系统下的开发环境 2. 熟悉vi的基本操作 3. 熟悉gcc编译器的基本原理 4. 熟练使用gcc编译器的常用选项 5 .熟练使用 ...

  6. Unix和Linux下C语言学习指南

    转自:http://www.linuxdiyf.com/viewarticle.php?id=174074 Unix和Linux下C语言学习指南 引言 尽管 C 语言问世已近 30 年,但它的魅力仍未 ...

  7. LINUX下C语言编程调用函数、链接头文件以及库文件

    LINUX下C语言编程经常需要链接其他函数,而其他函数一般都放在另外.c文件中,或者打包放在一个库文件里面,我需要在main函数中调用这些函数,主要有如下几种方法: 1.当需要调用函数的个数比较少时, ...

  8. Linux下提权常用小命令

    有些新手朋友在拿到一个webshell后如果看到服务器是Linux或Unix操作系统的就直接放弃提权,认为Linux或Unix下的提权很难,不是大家能做的,其实Linux下的提权并没有很多人想象的那么 ...

  9. linux下C语言多线程编程实例

    用一个实例.来学习linux下C语言多线程编程实例. 代码目的:通过创建两个线程来实现对一个数的递加.代码: //包含的头文件 #include <pthread.h> #include ...

随机推荐

  1. 001PHP文件处理——文件处理disk_total_space disk_free_space basename dirname file_exists filetype

    <?php /** * 文件处理disk_total_space disk_free_space basename dirname file_exists filetype */ //disk_ ...

  2. EPANET头文件解读系列6——HASH.H

    该文件是EPANET中HASH.C的头文件,下面列出了该文件的源码以及我的中文注释 /* HASH.H**** Header file for Hash Table module HASH.C***/ ...

  3. 在ubuntu16上进行nginx+uwsgi+django部署的简要步骤

    网上有很多部署教程,说了一大堆,遇到坑还是要自己一个个解决,这里有几个比较重要的坑大家一定要注意. 1.首先要安装python和python-dev环境,如果没有安装python-dev后面安装有些依 ...

  4. day02Java基础学习笔记

    自动类型转换:容量小的类型自动转换为容量大的数据类型.数据类型按容量大小排序为: byte,short,char之间不会相互转换,他们三者在计算时首先转换为int类型 1.各种进制的表现形式和特点 二 ...

  5. 判断对称二叉树 python代码

    对称二叉树的含义非常容易理解,左右子树关于根节点对称,具体来讲,对于一颗对称二叉树的每一颗子树,以穿过根节点的直线为对称轴,左边子树的左节点=右边子树的右节点,左边子树的右节点=左边子树的左节点.所以 ...

  6. c++ istringstream的用法

    一.测试代码 istringstream 是将字符串变成字符串迭代器一样,将字符串流在依次拿出,比较好的是,它不会将空格作为流.这样就实现了字符串的空格切割. #include<iostream ...

  7. springboot将项目打成war包

    1. 将项目的打包方式改为war包 <groupId>com.cc</groupId> <artifactId>aaaaaa</artifactId> ...

  8. [TopCoder14647]HiddenRabbits

    vjudge description 有一棵\(n\)个节点的树和\(m\)只兔子,每只兔子要住在一个点上(可以多只兔子住在同一个点上).有\(q\)组要求,每组形如"当以\(r\)为根时, ...

  9. Hibernate环境搭建+struts整合

    说明:本文档,是和struts2+hibernate的整合示例. lib下还有struts2的jar包,本示例没有显示.struts2的搭建参考struts2的环境搭建 一下载hibernate的ja ...

  10. Python ---- list和dict遍历

    refer to: http://www.cnblogs.com/icejoywoo/p/3531869.html 对于python3, 可能有不一样之处,   refer to: http://do ...