1.使用strtok函数
#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
OutputA string of ,,tokens
and some more tokensTokens:
A
string
of
tokens
and
some
more
tokens
2。使用函数:
SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
具体参考MSDN
#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
OutputA string of ,,tokens
and some more tokensTokens:
A
string
of
tokens
and
some
more
tokens
2。使用函数:
SHFileOperation(
LPSHFILEOPSTRUCT lpFileOp
);
具体参考MSDN
LPCWSTR lpExistingFileName,
// pointer to name of an existing file
LPCWSTR lpNewFileName,
// pointer to filename to copy to
LPPROGRESS_ROUTINE lpProgressRoutine,
// pointer to the callback function
LPVOID lpData, // to be passed to the callback function
LPBOOL pbCancel, // flag that can be used to cancel the operation
DWORD dwCopyFlags // flags that specify how the file is copied
);