Reprinted: https: //blog.csdn.net/lile777/article/details/41819449
sprintf_s function usage
Function: the output data is formatted into a string
Function prototype :
-
int sprintf_s(
-
-
char *buffer,
-
-
size_t sizeOfBuffer,
-
-
const char *format [,
-
-
argument] ...
-
-
);
You need to include the header file: stdio.h
note:
sprintf_s () is sprintf () version of security to avoid buffer length specified by sprintf () overflow risks
Program example:
-
filename char [ 1024]; // need to pre-allocate buffers
-
-
char path1[128] = "D:\\Program\\Tesseract-OCR\\tesseract.exe";
-
char path2[128] = "D:\\Program\\Tesseract-OCR\\";
-
char path3[128] = "D:\\Program\\Tesseract-OCR\\txt";
-
char path4[128] = "-l chi_sim";
-
-
sprintf_s(filename, sizeof( filename ), "%s %s %s %s", path1,filepath,path3,path4);
-
-
system(filename);
>>> http://blog.csdn.net/tigernana/article/details/6916491
related functions:
snprintf()