惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
大猫的无限游戏
大猫的无限游戏
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
M
MIT News - Artificial intelligence
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
P
Proofpoint News Feed
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理

博客园 - pipicfan

unity性能优化之Drawcall优化 谈谈我是如何面试技术人员的 Shader中颜色的加法和乘法的区别 unity性能优化-实际开发中需要注意的点 cocos2dx 新手引导 c++面试题 c++实现委托 屁屁桌面管理 War3Tool dota改键v3.3版 魔兽全屏改键工具 很犀利的错误 关于vs2003环境支持win7 的 IP设置 自己的毕业设计windows管理软件 很容易犯的错误 敏感词过滤和谐社会1.0版 宿舍计费系统105加强版 自己实现string类 用C++ 设计一个不能被继承的类 (转)字符编码笔记:ASCII,Unicode和UTF-8
向字符数组中插入一个字符
pipicfan · 2018-11-06 · via 博客园 - pipicfan
    char comment[32] = "test#20170420|0420";
    char *pos = strchr(comment, '#');
    char front[32]={0};
    char back[32]={0};
    char newComment[32] = {0};
    memcpy(front, comment, pos-comment);
    strcpy_s(back, pos);
    sprintf_s(newComment, "%sC%s", front, back);
    std::cout<<newComment<<endl;

任何new内存都是消耗的,正确的做法是使用memcpy