📄 ngsplitpath.cpp
字号:
//////////////////////////////////////////////////////////////////////
// NGSplitPath.cpp : implementation of the CNGSplitPath class. //
// (c) 1999, Kevin Lussier //
//////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "NGSplitPath.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CNGSplitPath::CNGSplitPath(LPCTSTR lpszPath)
{
// Initialize our objects
memset( szPath, 0, sizeof( szPath ) );
memset( szDrive, 0, sizeof( szDrive ) );
memset( szDir, 0, sizeof( szDir ) );
memset( szFilename, 0, sizeof( szFilename ) );
memset( szExtension, 0, sizeof( szExtension ) );
// If we were given a path, split it
if (lpszPath != NULL)
{
Split(lpszPath);
}
}
BOOL CNGSplitPath::Split(LPCTSTR lpszPath)
{
// If we weren't given a path, fail
if ( lpszPath == NULL )
{
// Return failure
return FALSE;
}
// Copy the path
_tcsncpy( szPath, lpszPath, sizeof( szPath ) - 1 );
// Split the given path
_tsplitpath( szPath, szDrive, szDir, szFilename, szExtension );
// If UNC name
if ( !_tcsncmp(szDir, "\\\\", 2))
{
// Get the computername
_tcsncpy(szComputer, _tcsstr(szDir, "\\\\")+2, sizeof(szComputer)-1 );
_tcsnset(_tcsstr(szComputer, "\\"), 0, 1);
// Strip the computername from the directory
_tcsncpy(szDir, _tcsstr(szDir, "\\\\")+2, sizeof(szDir)-1 );
_tcsncpy(szDir, _tcsstr(szDir, "\\"), sizeof(szDir)-1 );
}
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -