_splitpath,生成路径;_makepath ,分解路径
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_makepath(path_buffer, "c", "//sample//progarm//","filename", "txt" );
printf( "Path created with _makepath: %s/n", path_buffer );
_makepath( path_buffer, drive, dir, fname, ext );
printf("Path extracted with _splitpath:/n");
printf("Drive: %s/n", drive );
printf("Dir: %s/n", dir );
printf("Filename: %s/n", fname );
printf("Ext: %s/n", ext );
return 1;
}
结果可以自己尝试啊,自己动手才是最好的!