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; }
Please call me JiangYouDang!