Through these 2 functions, the main completion of the construction of the file name
( 1 ) _splitpath function--Decomposition path function
char*drwfullpath = "D:\\TEST\\8102.DRW";
CHARSAVEDRIVE[200];
CHARSAVEDIR[200];
CHARSAVENAME[100];
CHARSAVEEXT[50];
_splitpath (Drwfullpath,savedrive,savedir,savename,saveext);
Results: Savedrive=d:
Savedir=\test\
savename=8102
Saveext=.drw
(2)strcatFunction--putsrcThe referred string is added to thedestat the end(coverdestat the end of the' + ')and add' + '.
extern char *strcat (char *dest,char *src); The header file should contain #include <string.h>
//pdf put it in the same directory. Results directory under
strcat (Savedir, "result\\");
Char *savepath = strcat (Savedrive,savedir);
mkdir (Savepath);
Char*destpdffullnamenoext = strcat (savedrive,savename);
CHARDESTDXFFULLNAME[1024];
sprintf (Destdxffullname, "%s.dxf", Destpdffullnamenoext);
Char *destpdffullname =strcat (Destpdffullnamenoext, ". pdf");
// The resulting result is: "D:\\test\\8102.pdf";
Additional functions:
strstr function--searches for the first occurrence of a string in another string. When the searched string is found, the function returns the address of the first matching string, or NULL if the searched string is not found .
&NBSP; |
extern char * strstr ( char &NBSP; *str1, const &NBSP; Char &NBSP; *str2); |
str1: target being searched for stringexpression to search.
str2: to find an object thestring expression to find.
return value: If str2 str1 str2 in str1 str1 str2 str2 str1
Example:
1 2 3 |
Char str[]= "1234xyz"; Char *str1=strstr(str, "the"); cout << str1 << Endl; |
shown is the : 34xyz
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Creo two times develop asynchronous mode--string manipulation function