C语言细节——库函数
1、把数字转为字符串,使用sprintf。
对整型使用%d,长整形为%ld,浮点型为%f。
2、strncpy()当目标串长度过小时,不能自动在尾部加上’\0’。
但是当目标串长度过大时,会用多个’\0’填充。
strcat就可以自动加’\0’
3、将字符转为大小写,有toupper()和tolower()
4、把字符串分隔成用空白作间隔符的段,可以使用strtok()
5、要使用处理正则表达式或通配符匹配的API,可以下载regexp库
6、库函数中有qsort(void *base, int nelem, int width, int (*fcmp)()),可以对数组进行快速排序
7、可以使用time(),ctime(),localtime()和strftime()就可以取得当前日期或时间。
原文地址:https://www.cnblogs.com/steven_oyj/p/1747691.html