/*
* CreatePath.c
*
* Created on: Feb 28, 2011
* Author: Karthikeyan.D
*/
#include <stdlib.h>
#include <stdio.h>
int main()
{
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_makepath(path_buffer, "D", "\\Testdir\\myexample\\", "testfile", "txt");
printf("Path created with _makepath(): %s\n", path_buffer);
_splitpath(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 0;
}
OUTPUT:
Path created with _makepath(): D:\Testdir\myexample\testfile.txt
Path extracted with _splitpath():
Drive: D:
Dir: \Testdir\myexample\
Filename: testfile
Ext: .txt
No comments:
Post a Comment