本文整理汇总了C++中PathAddBackslash函数的典型用法代码示例。如果您正苦于以下问题:C++ PathAddBackslash函数的具体用法?C++ PathAddBackslash怎么用?C++ PathAddBackslash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PathAddBackslash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _T
bool CFileControlTool::InternalFindFile(LPCTSTR sFindPath, LPCTSTR sFindFileName, ULONGLONG &uCountFolder, ULONGLONG &uCountFile,PFINDFILE pCallbackFindFile,PFINDFOLDER pCallbackFindFolder,BOOL bFuzzy,BOOL bDirectory,PVOID pFileParameter,PVOID pDirectoryParameter)
{
HANDLE hFind;
BOOL fFinished = FALSE;
WIN32_FIND_DATA FindFileData;
TCHAR sPath[MAX_PATH],sFormatFileName[MAX_PATH+3] = _T("*");
lstrcpy(sFormatFileName, sFindPath);
if (bFuzzy){
lstrcat(sFormatFileName,_T("\\*"));
lstrcat(sFormatFileName, sFindFileName);
lstrcat(sFormatFileName, _T("*"));
}else {
PathAddBackslash(sFormatFileName);
lstrcat(sFormatFileName,sFindFileName);
}
hFind = FindFirstFile(sFormatFileName, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
return FALSE;
} else {
while (!fFinished)
{
lstrcpy(sPath, sFindPath);
PathAddBackslash(sPath);
//lstrcat(sPath, _T("//"));
//PathAddExtension(sPath,FindFileData.cFileName);
//lstrcat(sPath, FindFileData.cFileName);
if (FILE_ATTRIBUTE_DIRECTORY & FindFileData.dwFileAttributes)
{
if (0 != lstrcmp(FindFileData.cFileName,_T(".")) && 0 != lstrcmp(FindFileData.cFileName,_T(".."))) {
if(pCallbackFindFolder(sPath,FindFileData.cFileName,pDirectoryParameter))
++uCountFolder;
}
}
else
{
if(pCallbackFindFile(sPath,FindFileData.cFileName,pFileParameter))
++uCountFile;
}
if (!FindNextFile(hFind, &FindFileData)) {
if (GetLastError() == ERROR_NO_MORE_FILES)
fFinished = TRUE;
else
break;
}
}
FindClose(hFind);
}
return TRUE;
}
开发者ID:killvxk,项目名称:WebbrowserLock,代码行数:58,代码来源:FileControlTool_.cpp
示例2: RKLSetLogPath
BOOL RKLOG_API RKLSetLogPath(LPCTSTR pszLogPath)
{
if (pszLogPath == NULL) {
GetTempPath(sizeof(g_szLogPath), g_szLogPath);
PathAddBackslash(g_szLogPath);
lstrcat(g_szLogPath, "rklog\\");
} else {
lstrcpy(g_szLogPath, pszLogPath);
PathAddBackslash(g_szLogPath);
}
return TRUE;
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:13,代码来源:rklog.cpp
示例3: directory_str
tstring directory_str() const {
TCHAR buf[MAX_PATH];
memcpy(buf, this->buf, sizeof(this->buf));
PathAddBackslash(buf);
return buf;
}
开发者ID:DroidInteractiveSoftware,项目名称:peerblock,代码行数:7,代码来源:pathx.hpp
示例4: getDirectory
std::string getDirectory(){
//filepath creatures
char fileName[MAX_PATH];
HINSTANCE hInstance = GetModuleHandle(NULL);
GetModuleFileName(hInstance, fileName, MAX_PATH);
char filePathAbs[MAX_PATH];
//make absolute
std::vector<int> slashes;
int j =0;
for(int i =0;i<MAX_PATH; i++){
if(fileName[i]=='\\'){
slashes.push_back(i);
}
if(fileName[i]=='.' && fileName[i+1]=='.' && fileName[i+2]=='\\'){
slashes.pop_back();
i++;
j=slashes.back()+1;
slashes.pop_back();
}else{
filePathAbs[j]=fileName[i];
j++;
}
}
PathRemoveFileSpec(filePathAbs);
PathAddBackslash(filePathAbs);
directory.clear();
directory.append(filePathAbs);
return directory;
}
开发者ID:kiniry-supervision,项目名称:walking-with-dinosaurs,代码行数:33,代码来源:pipe.cpp
示例5: switch
CString CBase_AnalysisTemplate::GetDataFolder(enumPADATATYPENAME nDataType)
{
TCHAR szOut[MAX_PATH];
DWORD dwAttr;
switch(nDataType) {
case PA_DATATYPENAME_SAMPLE:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathSample);
break;
case PA_DATATYPENAME_TASK:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathTask);
break;
case PA_DATATYPENAME_COMPOUND:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathCompound);
break;
case PA_DATATYPENAME_METHOD:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathMethod);
break;
case PA_DATATYPENAME_CRYSTALREPORT:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathCrystalReport);
break;
case PA_DATATYPENAME_LOG:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathLog);
break;
case PA_DATATYPENAME_DATA:
default:
StrCpy(szOut, g_cConfigIni.CurrentSystem().m_szPathData);
}
dwAttr = GetFileAttributes(szOut);
if (dwAttr == INVALID_FILE_ATTRIBUTES || !(dwAttr & FILE_ATTRIBUTE_DIRECTORY)) {
SHCreateDirectory(NULL, szOut);
}
PathAddBackslash(szOut);
return CString(szOut);
}
开发者ID:Wanghuaichen,项目名称:SignalProcess,代码行数:35,代码来源:Base_AnalysisTemplate.cpp
示例6: CreateFolder
static BOOL CreateFolder(LPCTSTR pszFolder)
{
char *pszWork;
pszWork = (char*)malloc(MAX_PATH);
lstrcpy(pszWork, pszFolder);
if (!PathFileExists(pszWork)) {
if (PathIsRoot(pszWork)) {
free(pszWork);
return FALSE;
}
char *pszWork2;
pszWork2 = (char *)malloc(MAX_PATH);
lstrcpy(pszWork2, pszWork);
PathAddBackslash(pszWork2);
lstrcpy(pszWork2, "..");
PathCanonicalize(pszWork, pszWork2);
free(pszWork2);
if (CreateFolder(pszWork)) {
BOOL ret = CreateDirectory(pszFolder, NULL);
free(pszWork);
return ret;
} else {
free(pszWork);
return FALSE;
}
}
free(pszWork);
return TRUE;
}
开发者ID:willmomo,项目名称:ry2kojima,代码行数:35,代码来源:rklog.cpp
示例7: md_dir_set
/// Directory handling
/// ==================
BOOL md_dir_set(UINT32 dir_seg4, UINT16 dir_off) {
CHAR dir_raw[MAX_PATH];
TCHAR dir_ucs2[MAX_PATH];
OEMCHAR *dos_dir;
OEMCHAR *real_dir;
BOOL ret;
dos_dir = mem_read_sjis2ucs2(dir_raw, dir_ucs2, dir_seg4, dir_off, MAX_PATH);
real_dir = md_drive_parse(dos_dir);
// Changing to an empty string would lead to an error, crashing DOS
if(real_dir[0] == _T('\0')) {
ret = 1;
} else {
ret = SetCurrentDirectory(real_dir);
}
// Don't set errors here!
// Changing the registers quickly leads to
// DOS crashing inside its own DIR function
if(ret) {
if(PathIsRelative(dos_dir)) {
OEMCHAR tmp[MAX_PATH];
lstrcpy(tmp, cur_dir);
PathAddBackslash(tmp);
lstrcat(tmp, real_dir);
PathCanonicalize(cur_dir, tmp);
} else {
lstrcpy(cur_dir, real_dir);
}
}
// Don't override DOS' handling of this one
return FALSE;
}
开发者ID:LasDesu,项目名称:np2debug,代码行数:37,代码来源:md_dir.c
示例8: UtilGetAbsPathName
//絶対パスの取得
bool UtilGetAbsPathName(CString &_FullPath,LPCTSTR lpszFileName)
{
ASSERT(lpszFileName&&_tcslen(lpszFileName)>0);
if(!lpszFileName||_tcslen(lpszFileName)<=0){
TRACE(_T("ファイル名が指定されていない\n"));
return false;
}
//---絶対パス取得
TCHAR szAbsPath[_MAX_PATH+1]={0};
{
TCHAR Buffer[_MAX_PATH+1]={0}; //ルートかどうかのチェックを行う
_tcsncpy_s(Buffer,lpszFileName,_MAX_PATH);
PathAddBackslash(Buffer);
if(PathIsRoot(Buffer)){
//ドライブ名だけが指定されている場合、
//_tfullpathはそのドライブのカレントディレクトリを取得してしまう
_tcsncpy_s(szAbsPath,lpszFileName,_MAX_PATH);
}
else if(!_tfullpath(szAbsPath,lpszFileName,_MAX_PATH)){
TRACE(_T("絶対パス取得失敗\n"));
return false;
}
}
_FullPath=szAbsPath;
return true;
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:29,代码来源:FileOperation.cpp
示例9: fileWalkOverPath
BOOL fileWalkOverPath(PSTR szPathIn,PSTR szPattern,BOOL bSubPath,PFN_WalkName WalkName,PVOID usrData)
{
char szWalkPath[_MAX_PATH];
char szWalkName[_MAX_PATH];
BOOL bCont;
HANDLE hFind;
WIN32_FIND_DATA nData;
bCont = TRUE;
strcpy(szWalkPath,szPathIn);
PathAddBackslash(szWalkPath);
if (bSubPath){
sprintf(szWalkName,"%s*.*",szWalkPath);
if (INVALID_HANDLE_VALUE != (hFind=FindFirstFile(szWalkName,&nData))){
do{
if (!FLAGON(nData.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY)) continue;
if (0 == strcmp(nData.cFileName,".") || 0 == strcmp(nData.cFileName,"..")) continue;
strcpyV(szWalkName,sizeof(szWalkName),"%s%s\\",szWalkPath,nData.cFileName);
bCont = WalkName(usrData,szWalkPath,&nData) && fileWalkOverPath(szWalkName,szPattern,TRUE,WalkName,usrData);
}while(bCont && FindNextFile(hFind,&nData));
FindClose(hFind);
}
}
strcpyV(szWalkName,sizeof(szWalkName),"%s%s",szWalkPath,szPattern);
if (INVALID_HANDLE_VALUE != (hFind=FindFirstFile(szWalkName,&nData))){
do{
if (0 == strcmp(nData.cFileName,".") || 0 == strcmp(nData.cFileName,"..")) continue;
bCont = WalkName(usrData,szWalkPath,&nData);
}while(bCont && FindNextFile(hFind,&nData));
FindClose(hFind);
}
return bCont;
}
开发者ID:cirosantilli,项目名称:netWork-fork,代码行数:33,代码来源:fileLib.c
示例10: UtilPathGetDirectoryPart
//パスのディレクトリ部分だけを取り出す
void UtilPathGetDirectoryPart(CString &str)
{
LPTSTR lpszBuf=str.GetBuffer(_MAX_PATH+1);
PathRemoveFileSpec(lpszBuf);
PathAddBackslash(lpszBuf);
str.ReleaseBuffer();
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:8,代码来源:FileOperation.cpp
示例11: LocateComponent
BOOL LocateComponent(LPCSTR lpszGameKey, LPCSTR lpszGameValue, LPCSTR lpszFileName, LPSTR lpszFilePath)
{
assert(lpszGameKey);
assert(lpszGameValue);
assert(lpszFileName);
BOOL bRetVal = FALSE;
HKEY hAppRegKey;
DWORD dwValueType, dwValueSize = MAX_PATH + 1;
char szRegPath[MAX_PATH + 1];
// This works almost identically to LocateGame, but this time we get the actual path of the game component
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpszGameKey, 0, KEY_READ, &hAppRegKey) == ERROR_SUCCESS
|| RegOpenKeyEx(HKEY_CURRENT_USER, lpszGameKey, 0, KEY_READ, &hAppRegKey) == ERROR_SUCCESS)
{
if (RegQueryValueEx(hAppRegKey, lpszGameValue, NULL, &dwValueType, (LPBYTE)&szRegPath, &dwValueSize) == ERROR_SUCCESS)
{
// Found the registry key. Append the file name to the directory.
PathAddBackslash(szRegPath);
strcat(szRegPath, lpszFileName);
if (PathFileExists(szRegPath) && !PathIsDirectory(szRegPath))
bRetVal = TRUE;
}
RegCloseKey(hAppRegKey);
}
if (lpszFilePath && bRetVal)
strcpy(lpszFilePath, szRegPath);
return bRetVal;
}
开发者ID:crabminister,项目名称:Coffee,代码行数:33,代码来源:Common.cpp
示例12: AfxMessageBoxEx
void CCheckDiskDlg::OnBnClickedCheck()
{
CString strCheckDrv;
for (int idx=0; idx<m_lstRigth.GetCount(); idx++)
{
CString str;
m_lstRigth.GetText(idx, str);
strCheckDrv += str[0];
}
if (strCheckDrv.IsEmpty())
{
AfxMessageBoxEx(TEXT("请选择您要进行检测修复的磁盘!"));
return;
}
TCHAR szFilePath[MAX_PATH] = {0}, szParam[MAX_PATH] = {0};
GetModuleFileName(NULL, szFilePath, MAX_PATH);
PathRemoveFileSpec(szFilePath);
PathAddBackslash(szFilePath);
lstrcat(szFilePath, TEXT("EncipherC.exe"));
lstrcat(szParam, TEXT("/SetChkdsk "));
lstrcat(szParam, strCheckDrv);
ShellExecute(NULL, TEXT("open"), szFilePath, szParam, TEXT(""), SW_SHOWNORMAL);
}
开发者ID:lubing521,项目名称:important-files,代码行数:25,代码来源:CheckDiskDlg.cpp
示例13: GetModuleFileName
bool WorkingParameters::SetFTPInfo(LPCTSTR userName, LPCTSTR password)
{
TCHAR configFilePath[MAX_PATH];
GetModuleFileName(NULL, configFilePath, _countof(configFilePath));
PathRemoveFileSpec(configFilePath);
PathAddBackslash(configFilePath);
_tcscat(configFilePath, _T("FTPCONFIG.ini"));
TCHAR serverIP[128];
GetPrivateProfileString(TEXT("Config"), TEXT("ServerIP"), NULL, serverIP, _countof(serverIP), configFilePath);
int serverPort = GetPrivateProfileInt(TEXT("Config"), TEXT("ServerPort"), 21, configFilePath);
FtpClient client;
if (!client.Connect(serverIP, serverPort, userName, DecodePassword(password)))
{
return false;
}
else
{
WritePrivateProfileString(TEXT("Config"), TEXT("User"), CodePassword(userName), configFilePath);
WritePrivateProfileString(TEXT("Config"), TEXT("Password"), password, configFilePath);
WritePrivateProfileString(TEXT("Upload"), TEXT("User"), CodePassword(userName), configFilePath);
WritePrivateProfileString(TEXT("Upload"), TEXT("Password"), password, configFilePath);
return true;
}
}
开发者ID:Echo-M,项目名称:producingManagementAK47,代码行数:28,代码来源:working_parameters.cpp
示例14: buf
/// <summary>Appends a trailing backslash if necessary</summary>
/// <returns>New path with the trailing backslash</returns>
Path Path::AppendBackslash() const
{
CharArrayPtr buf( Copy() );
// Supply copy of buffer
PathAddBackslash(buf.get());
return buf.get();
}
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:10,代码来源:Path.cpp
示例15: LoadXinputDLL
void LoadXinputDLL()
{
LPVOID pReset = NULL;
LPTSTR pFile = NULL;
TCHAR path[MAX_PATH];
TCHAR buffer[MAX_PATH];
GetModuleFileName(hThis, path, MAX_PATH);
PathRemoveFileSpec(path);
PathAddBackslash(path);
pFile = PathCombine(buffer,path,_T("xinput1_4.dll"));
if(pFile)
{
hXInput = LoadLibrary(pFile);
pReset = GetProcAddress(hXInput,"reset");
if(!pReset) FreeLibrary(hXInput);
}
pFile = PathCombine(buffer,path,_T("xinput1_3.dll"));
if(pFile)
{
hXInput = LoadLibrary(pFile);
pReset = GetProcAddress(hXInput,"reset");
if(!pReset) FreeLibrary(hXInput);
}
pFile = PathCombine(buffer,path,_T("xinput1_2.dll"));
if(pFile)
{
hXInput = LoadLibrary(pFile);
pReset = GetProcAddress(hXInput,"reset");
if(!pReset) FreeLibrary(hXInput);
}
pFile = PathCombine(buffer,path,_T("xinput1_1.dll"));
if(pFile)
{
hXInput = LoadLibrary(pFile);
pReset = GetProcAddress(hXInput,"reset");
if(!pReset) FreeLibrary(hXInput);
}
pFile = PathCombine(buffer,path,_T("xinput9_1_0.dll"));
if(pFile)
{
hXInput = LoadLibrary(pFile);
pReset = GetProcAddress(hXInput,"reset");
if(!pReset) FreeLibrary(hXInput);
}
if(!pReset)
{
pFile = PathCombine(buffer,path,_T("xinput9_1_0.dll"));
if(pFile) hXInput = LoadLibrary(pFile);
}
}
开发者ID:jeppeter,项目名称:x360ce,代码行数:58,代码来源:dllmain.cpp
示例16: GetModuleFilePath
void GetModuleFilePath(
LPSTR pszDst, /* [ou] パス格納先バッファ */
DWORD dwSize) /* [in] パス格納先バッファサイズ */
{
ZeroMemory (pszDst, dwSize);
GetModuleFileName (NULL, pszDst, dwSize); /* モジュール名を取得 */
PathRemoveFileSpec (pszDst); /* ファイル名部分を消す */
PathAddBackslash (pszDst); /* 「\」を追加 */
}
开发者ID:psgsgpsg,项目名称:scrapbookonline,代码行数:9,代码来源:SBOGlobal.cpp
示例17: CheckAccessPermissions
HRESULT CheckAccessPermissions()
{
HRESULT hr = S_OK;
CCriticalSection cs(&g_csInitClb);
WCHAR pszTempDir[MAX_PATH+1];
DWORD dwLen;
if (g_bCheckedAccess) {
goto Exit;
}
hr = cs.Lock();
if (FAILED(hr)) {
goto Exit;
}
if (g_bCheckedAccess) {
cs.Unlock();
goto Exit;
}
StrCpy(pszTempDir, g_szWindowsDir);
PathAddBackslash(pszTempDir);
dwLen = lstrlenW(pszTempDir);
while (1) {
GetRandomName(pszTempDir + dwLen, TEMP_RANDOM_DIR_LENGTH); // create random dir of 15 chars.
if (CreateDirectory(pszTempDir, NULL)) {
g_CurrUserPermissions = READ_WRITE;
g_GAC_AccessMode = READ_WRITE;
if(!RemoveDirectory(pszTempDir))
{
// ASSERT(0); // oops we left a random dir in winDir
}
break;
}
else {
if (GetLastError() == ERROR_ALREADY_EXISTS) {
continue;
}
hr = HRESULT_FROM_WIN32(GetLastError());
break;
}
hr = S_OK;
}
g_bCheckedAccess = TRUE;
cs.Unlock();
Exit:
return hr;
}
开发者ID:ArildF,项目名称:masters,代码行数:56,代码来源:cacheutils.cpp
示例18: tiCurr
HRESULT CChildFrame::_RecursionExtractData(LPCTSTR lpszRoot, HTREEITEM hCurrItem, CTreeViewCtrlEx * pTreeView)
{
HRESULT hr = S_OK;
CTreeItem tiCurr(hCurrItem, pTreeView);
TREE_ITEM_DATA * pTmp = (TREE_ITEM_DATA *)tiCurr.GetData();
if (NULL == pTmp) {
return hr;
}
TCHAR szPathCopy[MAX_PATH] = { 0 };
lstrcpyn(szPathCopy, lpszRoot, _countof(szPathCopy));
PathAddBackslash(szPathCopy);
TCHAR szCurrName[MAX_PATH/2] = { 0 };
tiCurr.GetText(szCurrName, _countof(szCurrName));
AdjustFileName(szCurrName);
if (STGTY_STORAGE == pTmp->dwStgType)
{
TCHAR *pIter = szCurrName;
while (*pIter && pIter<szCurrName+lstrlen(szCurrName))
{
if(*pIter == '.') { *pIter = '_'; }
pIter ++;
}
TCHAR szNowPath[MAX_PATH] = { 0 };
wnsprintf(szNowPath, _countof(szNowPath), _T("%s%s"), szPathCopy, szCurrName);
::SHCreateDirectoryEx(*pTreeView, szNowPath, NULL);
}
else if (STGTY_STREAM == pTmp->dwStgType)
{
TCHAR szFileName[MAX_PATH] = { 0 };
wnsprintf(szFileName, _countof(szFileName), _T("%s%s"), szPathCopy, szCurrName);
CComPtr<IStream> spFile;
hr = pTmp->spStgOrStrm->QueryInterface(&spFile);
if (FAILED(hr)) return hr;
hr = WriteStreamToFile(szFileName, spFile);
}
lstrcat(szPathCopy, szCurrName);
HTREEITEM hChild = tiCurr.GetChild();
while (NULL != hChild)
{
_RecursionExtractData(szPathCopy, hChild, pTreeView);
hChild = CTreeItem(hChild, pTreeView).GetNextSibling();
}
return hr;
}
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:55,代码来源:ChildFrm.cpp
示例19: Buffer
CFilePath &CFilePath::AddBackslash()
{
if (GetLastChar(msPath) != gsBackslash)
{
CStringLock Buffer(msPath, msPath.GetLength()+1);
PathAddBackslash(Buffer);
}
return *this;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:11,代码来源:FilePath.cpp
示例20: fileSplitPathName
void fileSplitPathName(PSTR szFull,PSTR szPath,PSTR szName)
{
int i;
for(i=strlen(szFull)-1;i>=0;i--) if ('\\' == szFull[i]) break;
strcpy(szPath,szFull);
szPath[i+1] = 0;
strcpy(szName,&szFull[i+1]);
if (0 == szPath[0]) GetCurrentDirectory(_MAX_PATH,szPath);
PathAddBackslash(szPath);
}
开发者ID:cirosantilli,项目名称:netWork-fork,代码行数:11,代码来源:fileLib.c
注:本文中的PathAddBackslash函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论