
C/C++
狂风落尽深红色
好记性也需要记笔记!
展开
-
C语言 snprintf的使用记录
1.示例代码#include <stdio.h>int main(){ char bufferH[50]; char bufferJ[50]; char* s = "runoobcom"; //9个字符 char* ss = "test"; //4个字符 // 读取字符串并存储在 buffer 中 int h = snprintf(bufferH, 12, "%s,%s\n", s,ss); //9+4+逗号+\原创 2022-05-31 15:42:29 · 199 阅读 · 0 评论 -
C/C++ 学习记录(持续更新)
样例测试1.字符串常用方法//Test.cpp#include<iostream>#include <cstring>using namespace std;int main(){ char* str ="Hello,world"; char* str1 = "Hello,world"; cout<< str <<endl; //字符串比较 int state = strcmp(str,str1); //原创 2022-05-31 14:27:31 · 104 阅读 · 0 评论