![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
大西瓜-PaulChan
成功=机遇+基础+兴趣!
展开
-
getopt()函数:分析命令行参数
头文件 #include 定义函数:int getopt(int argc, char * const argv[], const char * optstring);函数说明:getopt()用来分析命令行参数。1、参数argc 和argv 是由main()传递的参数个数和内容。2、参数optstring 则代表欲处理的选项字符串。此函数会原创 2016-10-09 14:55:56 · 264 阅读 · 0 评论 -
snprintf()函数:最多从源串中拷贝n-1个字符到目标串中,后加一个0
int snprintf(char *restrict buf, size_t n, const char * restrict format, ...);函数说明:最多从源串中拷贝n-1个字符到目标串中,然后再在后面加一个0。所以如果目标串的大小为n 的话,将不会溢出。函数返回值:若成功则返回欲写入的字符串长度,若出错则返回负值。示例1(普通用法):原创 2016-10-09 15:14:23 · 1111 阅读 · 0 评论 -
C语言---结构体成员变量加“点”赋值
结构体成员变量加“点”赋值#include typedef struct _led { int ver; char name[10]; }LED; int main(void) { int i; LED leds[]={ { .ver=3,原创 2017-07-19 21:49:03 · 3777 阅读 · 0 评论