c snprintf demo

1. snprintf(char *buff, size_t len, char *format, ....),格式化字符串到buff中

复制代码
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>


int data = 0;


int main() {
    char welcomeMsg[100];
    char *name = "guanxiansneg";
    snprintf(welcomeMsg, 100, "welcome %s to c", name);
    printf("welcomeMsg:%s\n", welcomeMsg);

    return 0;
}
复制代码

 

posted on   luckygxf  阅读(130)  评论(0编辑  收藏  举报

导航

点击右上角即可分享
微信分享提示