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

本文详细归纳了C语言中常用的内存及字符串控制、操作、转换、连接、分割等函数,包括查找、拷贝、比较、连接、分割、求长等函数,并提供了相应的替换方案和使用说明。

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

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

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

 

 

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

 

  • 已经不赞成使用的函数归类
复制代码
*
*           函数名                                                   用途                                    替换方案
*1. int bcmp(const void *s1, const void *s2, size_t n);         compare byte sequences                        memcmp
*
*2. void bcopy(const void *src, void *dest, size_t n);          copy byte sequence                            memcpy Or memmove
*
*3. void bzero(void *s, size_t n);                              write zero-valued bytes                       memset
*
*4. char *index(const char *s, int c);                          locate character in string                    strchr
*
*5. char *rindex(const char *s, int c);                         locate character in string                    strrchr
*
复制代码
  • 内存或字符串查找函数归类
复制代码
*           函数名                                                   用途                                       备注
*1. 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.
*
*2. 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.
*
*3. 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.
*
*4. 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.
*
*5. 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.
*
*6. 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.
*
复制代码
  • 内存及字符串拷贝、比较函数归类
复制代码
*           函数名                                                  用途                                        备注
*
*1. void *memcpy(void *dest, const void *src, size_t n);        copy memory area                      The memcpy() function returns a pointer to dest.
*
*2. char *strcpy(char *dest, const char *src);                  copy a string                         return a pointer to the destination string dest.
*
*3. char *strncpy(char *dest, const char *src, size_t n);       copy a string                         return a pointer to the destination string dest.
*
*4. void *memmove(void *dest, const void *src, size_t n);       copy memory area , may overlap        returns a pointer to dest.
*
*5. 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
*
*6. 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
*
*7. int strncmp(const char *s1, const char *s2, size_t n);      compare two strings                   UP
*
*8. int strcasecmp(const char *s1, const char *s2);             compare two strings ignoring case     UP
*
*9. int strncasecmp(const char *s1, const char *s2, size_t n);  compare two strings ignoring case     UP
*
* 10. 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
* 
复制代码
  • 内存或字符串连接、分割、求长等函数归类
复制代码
*           函数名                                                  用途                                            备注
*1. char *strcat(char *dest, const char *src);                  concatenate two strings                 return a pointer to the resulting string dest
*
*2. char *strncat(char *dest, const char *src, size_t n);       UP                                      UP
*
*3. char *strtok(char *str, const char *delim);                 extract tokens from strings             第一次调用时,str必须不为空,第二次调用str必须为空
*
*4. char *strtok_r(char *str, const char *delim, char **saveptr);   可重入函数,线程安全                推荐使用这个分割函数,具体讨论见http://blog.youkuaiyun.com/liuintermilan/article/details/6283705
*
复制代码

 

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

 

作者: TigerXiao

Email: tiger.xiaowh001@gmail.com

出处: 老虎工作室

说明: 欢迎讨论、转载,转载请注明出处。

分类:  C
标签:  归纳整理
内容概要:本文介绍了ENVI Deep Learning V1.0的操作教程,点讲解了如何利用ENVI软件进行深度学习模型的训练与应用,以实现遥感图像中特定目标(如集装箱)的自动提取。教程涵盖了从数据准备、标签图像创建、模型初始化与训练,到执行分类及结果优化的完整流程,并介绍了精度评价与通过ENVI Modeler实现一键化建模的方法。系统基于TensorFlow框架,采用ENVINet5(U-Net变体)架构,支持通过点、线、面ROI或分类图生成标签数据,适用于多/高光谱影像的单一类别特征提取。; 适合人群:具备遥感图像处理基础,熟悉ENVI软件操作,从事地理信息、测绘、环境监测等相关领域的技术人员或研究人员,尤其是希望将深度学习技术应用于遥感目标识别的初学者与实践者。; 使用场景及目标:①在遥感影像中自动识别和提取特定地物目标(如车辆、建筑、道路、集装箱等);②掌握ENVI环境下深度学习模型的训练流程与关键参数设置(如Patch Size、Epochs、Class Weight等);③通过模型调优与结果反馈提升分类精度,实现高效自动化信息提取。; 阅读建议:建议结合实际遥感项目边学边练,点关注标签数据制作、模型参数配置与结果后处理环节,充分利用ENVI Modeler进行自动化建模与参数优化,同时注意软硬件环境(特别是NVIDIA GPU)的配置要求以保障训练效率。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值