Currently viewing: GipsySoft » Front Page» Articles

CSplitPath

Wraps up the splitpath and makepath functions for convienience and also provides some error checking for the setting of the path components.

Tested in UNICODE

Example

CSplitPath path( "c:\\Program Files\\Test\\Thing.exe" );

TRACE("Drive %s\n", path.GetDrive() );
TRACE("Directory %s\n", path.GetDirectory() );
TRACE("Filename %s\n", path.GetFilename() );
TRACE("Extension %s\n", path.GetExtension() );

path.SetExtension( "Not" );

TCHAR szBuffer[ MAX_PATH + MAX_PATH ];
path.Make( szBuffer );
TRACE("File path now %s\n", szBuffer );

 

Click to view the source code

See also