error code:

char buf[];
sprintf_s(buf, , "predicted position:(%3d, %3d)", predict_pt.x, predict_pt.y);
cv::putText(image, buf, cv::Point(,), CV_FONT_HERSHEY_SCRIPT_COMPLEX, , cv::Scalar(,,), , );
sprintf_s(buf, , "current position :(%3d, %3d)", mousePosition.x, mousePosition.y);
cv::putText(image, buf, cv::Point(,), CV_FONT_HERSHEY_SCRIPT_COMPLEX, , cv::Scalar(,,), , );

error discription:

‘sprintf_s’ was not declared in this scope
sprintf_s(buf, , "predicted position:(%3d, %3d)", predict_pt.x, predict_pt.y);

windows平台下线程安全的格式化字符串函数sprint_s并非标准C函数,因此linux下无法使用,但可以使用snprintf函数代替。

right code:

char buf[];
snprintf(buf, , "predicted position:(%3d, %3d)", predict_pt.x, predict_pt.y);
cv::putText(image, buf, cv::Point(,), CV_FONT_HERSHEY_SCRIPT_COMPLEX, , cv::Scalar(,,), , );
snprintf(buf, , "current position :(%3d, %3d)", mousePosition.x, mousePosition.y);
cv::putText(image, buf, cv::Point(,), CV_FONT_HERSHEY_SCRIPT_COMPLEX, , cv::Scalar(,,), , );

Re:

1.linux下sprintf_s函数的替代;

End

linux下sprintf_s函数的替代的更多相关文章

  1. linux下sprintf_s函数的替代(转载)

    转自:http://www.cnblogs.com/yeahgis/archive/2013/01/22/2872179.html windows平台下线程安全的格式化字符串函数sprint_s并非标 ...

  2. 对于linux下system()函数的深度理解(整理)

    原谅: http://blog.sina.com.cn/s/blog_8043547601017qk0.html 这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同 ...

  3. 转:对于linux下system()函数的深度理解(整理)

    这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同的system()函数,直接在shell下输入system()函数中调用的命令也都一切正常.就没理这个bug,以为 ...

  4. 【C/C++】Linux下system()函数引发的错误

    http://my.oschina.net/renhc/blog/54582 [C/C++]Linux下system()函数引发的错误 恋恋美食  恋恋美食 发布时间: 2012/04/21 11:3 ...

  5. (笔记)Linux下system()函数的深度理解(整理)

    注:从其它地方转的非常好的一篇文章,值得深究! 这几天调程序(嵌入式linux),发现程序有时就莫名其妙的死掉,每次都定位在程序中不同的system()函数,直接在shell下输入system()函数 ...

  6. linux下syscall函数,SYS_gettid,SYS_tgkill

    出处:http://blog.chinaunix.net/uid-28458801-id-4630215.html     linux下syscall函数,SYS_gettid,SYS_tgkill  ...

  7. Linux下c函数dlopen实现加载动态库so文件代码举例

    dlopen()是一个强大的库函数.该函数将打开一个新库,并把它装入内存.该函数主要用来加载库中的符号,这些符号在编译的时候是不知道的.这种机制使得在系统中添加或者删除一个模块时,都不需要重新编译了. ...

  8. [转帖]Linux下fork函数及pthread函数的总结

    Linux下fork函数及pthread函数的总结 https://blog.csdn.net/wangdd_199326/article/details/76180514 fork Linux多进程 ...

  9. [Android Memory] Linux下malloc函数和OOM Killer

    http://www.linuxidc.com/Linux/2010-09/28364.htm Linux下malloc函数主要用来在用户空间从heap申请内存,申请成功返回指向所分配内存的指针,申请 ...

随机推荐

  1. idea忽略文件

  2. angular5 ng-bootstrap和ngx-bootstrap区别

    https://angular.cn/resources ngx-bootstrap 安装: npm install ngx-bootstrap --save 再引入css <link href ...

  3. Linux : 密码正确不能正常登陆,日志提示Could not get shadow information for user

    今天,再玩Centos7的时候,尝试修改了下ssh的端口.因为默认开启了SELinux,如果没有修改这个文件配置就修改端口sshd服务就不能正常启动了. 但是,当我修改会22端口的时候还是不能正常登陆 ...

  4. dd 命令常用功能收集(ing...)

    xu言: 发现自己老是忘记一些不怎么常用,但是一定会用到的命令...so,做个备忘吧 Tips: sudo sh -c "head -c 15M /dev/urandom > test ...

  5. 百度安卓SDK秘钥Key错误

    下载官方安卓地图demo,输入报名和sha1申请AK,发现key错误 构建的时候要指定生成的key 安卓定位BaiduLocDemo出现aapt.exe finished with non-zero ...

  6. Mac搭建个人服务器开发微信公众号

    个人电脑搭建小型服务器面临的一个重要问题就是网络问题,我把解决的过程简单记录一下,准备以后参考. 1. 内网穿透 由于个人所在网络是一个局域网,没有公网的IP,因此在公网是不能直接访问个人电脑的服务器 ...

  7. python-day49--前端 css-层叠样式表

    1.css功能: 对html标签的渲染和布局 2.CSS 要掌握的两方面: 1.查找标签 选择器 2.操作标签  (对属性进行操作) 3.CSS 语法 CSS 规则由两个主要的部分构成:选择器,以及一 ...

  8. 文件的移动,删除 rename remove unlink 函数

    int rename(const char *oldpath, const char *newpath); rename()  renames  a  file,  moving it between ...

  9. 管道与popen函数与重定向

    转自:http://www.tldp.org/LDP/lpg/node12.html Pipes the Easy Way! LIBRARY FUNCTION: popen(); PROTOTYPE: ...

  10. java并发编程:线程安全管理类--原子操作类--AtomicReferenceArray<E>

    1.类 AtomicReferenceArray<E> public class AtomicReferenceArray<E>extends Objectimplements ...