这篇教程C++ GetCurrentDirectoryA函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetCurrentDirectoryA函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentDirectoryA函数的具体用法?C++ GetCurrentDirectoryA怎么用?C++ GetCurrentDirectoryA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetCurrentDirectoryA函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ResolveIgniteHome std::string ResolveIgniteHome(const std::string& path) { // 1. Check passed argument. if (IsValidDirectory(path)) return path; // 2. Check environment variable. std::string home = GetEnv(IGNITE_HOME); if (IsValidDirectory(home)) return home; // 3. Check current work dir. DWORD curDirLen = GetCurrentDirectoryA(0, NULL); if (!curDirLen) return std::string(); FixedSizeArray<char> curDir(curDirLen); curDirLen = GetCurrentDirectoryA(curDir.GetSize(), curDir.GetData()); if (!curDirLen) return std::string(); std::string curDirStr(curDir.GetData()); return ResolveIgniteHome0(curDirStr); }
开发者ID:gridgain,项目名称:gridgain,代码行数:29,
示例2: error/// Switches you into a working directoryvoid Window::cd( char *path ){ if( !path ) { error( "You can't change directory to NULL, nothing done" ) ; return ; } // Save the current directory to the stack char *cwd = (char*)malloc( MAX_PATH ) ; GetCurrentDirectoryA( MAX_PATH, cwd ) ; directories.push( cwd ) ; if( !SetCurrentDirectoryA( path ) ) { error( "Couldn't switch directory to %s", path ) ; } else { // This verifies the cd command worked char nowDir[MAX_PATH]; GetCurrentDirectoryA( MAX_PATH, nowDir ) ; info( "Current working directory is '%s'", nowDir ) ; }}
开发者ID:sdp0et,项目名称:gtp,代码行数:26,
示例3: getcwdcv::String getcwd(){ CV_INSTRUMENT_REGION(); cv::AutoBuffer<char, 4096> buf;#if defined WIN32 || defined _WIN32 || defined WINCE#ifdef WINRT return cv::String();#else DWORD sz = GetCurrentDirectoryA(0, NULL); buf.allocate((size_t)sz); sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data()); return cv::String(buf.data(), (size_t)sz);#endif#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ for(;;) { char* p = ::getcwd(buf.data(), buf.size()); if (p == NULL) { if (errno == ERANGE) { buf.allocate(buf.size() * 2); continue; } return cv::String(); } break; } return cv::String(buf.data(), (size_t)strlen(buf.data()));#else return cv::String();#endif}
开发者ID:JoeHowse,项目名称:opencv,代码行数:33,
示例4: GetModuleBasestatic ULONG_ADDR CALLBACK GetModuleBase(HANDLE hProcess, ULONG_ADDR dwAddress){ MEMORY_BASIC_INFORMATION memoryInfo; ULONG_ADDR dwAddrBase = SymGetModuleBase(hProcess, dwAddress); if (dwAddrBase) { return dwAddrBase; } if (VirtualQueryEx(hProcess, (void*)(GC_ULONG_PTR)dwAddress, &memoryInfo, sizeof(memoryInfo))) { char filePath[_MAX_PATH]; char curDir[_MAX_PATH]; char exePath[_MAX_PATH]; DWORD size = GetModuleFileNameA((HINSTANCE)memoryInfo.AllocationBase, filePath, sizeof(filePath)); /* Save and restore current directory around SymLoadModule, see KB */ /* article Q189780. */ GetCurrentDirectoryA(sizeof(curDir), curDir); GetModuleFileNameA(NULL, exePath, sizeof(exePath));#if defined(_MSC_VER) && _MSC_VER == 1200 /* use strcat for VC6 */ strcat(exePath, "//..");#else strcat_s(exePath, sizeof(exePath), "//..");#endif /* _MSC_VER >= 1200 */ SetCurrentDirectoryA(exePath);#ifdef _DEBUG GetCurrentDirectoryA(sizeof(exePath), exePath);#endif SymLoadModule(hProcess, NULL, size ? filePath : NULL, NULL, (ULONG_ADDR)(GC_ULONG_PTR)memoryInfo.AllocationBase, 0); SetCurrentDirectoryA(curDir); } return (ULONG_ADDR)(GC_ULONG_PTR)memoryInfo.AllocationBase;}
开发者ID:qykth-git,项目名称:bdwgc,代码行数:35,
示例5: fs_GetFullPath/* take a path with a drive letter, possibly relative, and return a full path * without the drive letter. This is the full path relative to the working * dir for that drive letter. The input and output paths can be the same. */long fs_GetFullPath(char *pathp, char *outPathp, long outSize){ char tpath[1000]; char origPath[1000]; char *firstp; long code; int pathHasDrive; int doSwitch; char newPath[3]; if (pathp[0] != 0 && pathp[1] == ':') { /* there's a drive letter there */ firstp = pathp+2; pathHasDrive = 1; } else { firstp = pathp; pathHasDrive = 0; } if (*firstp == '//' || *firstp == '/') { /* already an absolute pathname, just copy it back */ strcpy(outPathp, firstp); return 0; } GetCurrentDirectoryA(sizeof(origPath), origPath); doSwitch = 0; if (pathHasDrive && (*pathp & ~0x20) != (origPath[0] & ~0x20)) { /* a drive has been specified and it isn't our current drive. * to get path, switch to it first. Must case-fold drive letters * for user convenience. */ doSwitch = 1; newPath[0] = *pathp; newPath[1] = ':'; newPath[2] = 0; if (!SetCurrentDirectoryA(newPath)) { code = GetLastError(); return code; } } /* now get the absolute path to the current wdir in this drive */ GetCurrentDirectoryA(sizeof(tpath), tpath); strcpy(outPathp, tpath+2); /* skip drive letter */ /* if there is a non-null name after the drive, append it */ if (*firstp != 0) { strcat(outPathp, "//"); strcat(outPathp, firstp); } /* finally, if necessary, switch back to our home drive letter */ if (doSwitch) { SetCurrentDirectoryA(origPath); } return 0;}
开发者ID:chanke,项目名称:openafs-osd,代码行数:63,
示例6: current_pathpath current_path() { std::vector<char> buffer(GetCurrentDirectoryA(0, NULL)); DWORD length = GetCurrentDirectoryA(buffer.size(), &buffer.front()); if(length == 0 || length + 1 >= buffer.size()) { buffer[0] = '/0'; } return path(&buffer.front());}
开发者ID:hulu1528,项目名称:ArxLibertatis,代码行数:8,
示例7: snewn/** Get local current directory. Returns a string which must be* freed.*/char *psftp_getcwd(void){ char *ret = snewn(256, char); int len = GetCurrentDirectoryA(256, ret); if (len > 256) ret = sresize(ret, len, char); GetCurrentDirectoryA(len, ret); return ret;}
开发者ID:identity0815,项目名称:os45,代码行数:13,
示例8: CurrentDirectorystd::string CurrentDirectory(void) { DWORD bufferLength = 0; bufferLength = GetCurrentDirectoryA(0, NULL); CHECK_WIN_ERROR; assert(bufferLength); std::string buffer(bufferLength - 1, '0'); bufferLength = GetCurrentDirectoryA(bufferLength, &buffer[0]); CHECK_WIN_ERROR; assert(bufferLength); return buffer;}
开发者ID:plainoldcj,项目名称:nubuck,代码行数:11,
示例9: iupdrvGetCurrentDirectorychar* iupdrvGetCurrentDirectory(void){ char* cur_dir = NULL; int len = GetCurrentDirectoryA(0, NULL); if (len == 0) return NULL; cur_dir = iupStrGetMemory(len + 2); GetCurrentDirectoryA(len + 1, cur_dir); cur_dir[len] = '//'; cur_dir[len + 1] = 0; return cur_dir;}
开发者ID:mwoz,项目名称:Hildim.Source,代码行数:14,
示例10: dbgGetCurrentDirectory/** Implement the Lua function GetCurrentDirectory(). * * Discover the current directory name and return it to the caller. * * /todo There is a low-probability memory leak here. The buffer used * to hold the current directory string came from malloc() and is held * across a call to lua_pushlstring() which can potentially throw an * error, which will leak the allocated buffer. The other bits of Win32 * API wrappers could have similar issues, and should be inspected. * * /param L Lua state context for the function. * /returns The number of values on the Lua stack to be returned * to the Lua caller. */static int dbgGetCurrentDirectory(lua_State *L){ char *buf = 0; DWORD len = 0; len = GetCurrentDirectoryA(0,NULL); if (!len) return luaL_error(L, "GetCurrentDirectory failed (%d)", GetLastError()); buf = malloc(len+1); if (!buf) return luaL_error(L,"GetCurrentDirectory can't allocate %ld chars", len); GetCurrentDirectoryA(len+1, buf); lua_pushlstring(L, buf, len); free(buf); return 1;}
开发者ID:luaforge,项目名称:luaservice,代码行数:29,
示例11: CWE785_Path_Manipulation_Function_Without_Max_Sized_Buffer__w32_04_badvoid CWE785_Path_Manipulation_Function_Without_Max_Sized_Buffer__w32_04_bad(){ if(STATIC_CONST_TRUE) { { char path[BAD_PATH_SIZE]; DWORD length; length = GetCurrentDirectoryA(BAD_PATH_SIZE, path); if (length == 0 || length >= BAD_PATH_SIZE) /* failure conditions for this API call */ { exit(1); } /* FLAW: PathAppend assumes the 'path' parameter is MAX_PATH */ /* INCIDENTAL: CWE 121 stack based buffer overflow, which is intrinsic to * this example identified on the CWE webpage */ if (!PathAppendA(path, "AAAAAAAAAAAA")) { exit(1); } printSizeTLine(strlen(path)); printIntLine(BAD_PATH_SIZE); printLine(path); } }}
开发者ID:maurer,项目名称:tiamat,代码行数:25,
示例12: is_a_valid_directoryintis_a_valid_directory(char* pcszDirectory){#ifndef WIN32 struct stat statbuf; if ( pcszDirectory[0] == '/0' ) return 0; lstat(pcszDirectory, &statbuf); if (S_ISDIR(statbuf.st_mode) == 1){ return 1; } write_log(LT_BOTH, "Error: %s is not a valid path!/n", pcszDirectory); return 0;#else char szPath[MAX_PATH]; int nRet = 0; GetCurrentDirectoryA(MAX_PATH, szPath); if ( SetCurrentDirectoryA(pcszDirectory) ) nRet = 1; SetCurrentDirectoryA(szPath); if ( nRet == 0 ) write_log(LT_BOTH, "Error: %s is not a valid path!/n", pcszDirectory); return nRet;#endif //WIN32}
开发者ID:pkxpp,项目名称:Study,代码行数:32,
示例13: test_setdir/* Routine to test that SetCurrentDirectory behaves as expected. */static void test_setdir(CHAR *olddir,CHAR *newdir, CHAR *cmprstr, INT pass, const CHAR *errstr){ CHAR tmppath[MAX_PATH], *dirptr; DWORD val,len,chklen; val=SetCurrentDirectoryA(newdir); len=GetCurrentDirectoryA(MAX_PATH,tmppath);/* if 'pass' then the SetDirectoryA was supposed to pass */ if(pass) { dirptr=(cmprstr==NULL) ? newdir : cmprstr; chklen=lstrlenA(dirptr); ok(val,"%s: SetCurrentDirectoryA failed/n",errstr); ok(len==chklen, "%s: SetCurrentDirectory did not change the directory, though it passed/n", errstr); ok(lstrcmpiA(dirptr,tmppath)==0, "%s: SetCurrentDirectory did not change the directory, though it passed/n", errstr); ok(SetCurrentDirectoryA(olddir), "%s: Couldn't set directory to it's original value/n",errstr); } else {/* else thest that it fails correctly */ chklen=lstrlenA(olddir); ok(val==0, "%s: SetCurrentDirectoryA passed when it should have failed/n",errstr); ok(len==chklen, "%s: SetCurrentDirectory changed the directory, though it failed/n", errstr); ok(lstrcmpiA(olddir,tmppath)==0, "%s: SetCurrentDirectory changed the directory, though it failed/n", errstr); }}
开发者ID:howard5888,项目名称:wineT,代码行数:35,
示例14: getCurrentDrive// Get current drive prefix "a:", if any// This is the same method as used in VC++ CRT.FXString FXSystem::getCurrentDrive(){#ifdef WIN32 FXchar buffer[MAXPATHLEN]; if(GetCurrentDirectoryA(MAXPATHLEN,buffer) && Ascii::isLetter((FXuchar)buffer[0]) && buffer[1]==':') return FXString(buffer,2);#endif return FXString::null; }
开发者ID:Tetimaru,项目名称:LLSIF-Helper,代码行数:9,
示例15: getIniValuebool getIniValue(string filename,string section,string key,string defultValue,string& value){ char lpBuffer[PATH_BUFFER_LENGTH]; ZeroMemory(lpBuffer,PATH_BUFFER_LENGTH); DWORD nBufferLength = GetCurrentDirectoryA( PATH_BUFFER_LENGTH, lpBuffer ); string path = ""; if (!nBufferLength) return false; path=lpBuffer; path+="//"; path+=filename; ZeroMemory(lpBuffer,PATH_BUFFER_LENGTH); nBufferLength= GetPrivateProfileStringA( section.c_str(), key.c_str(), defultValue.c_str(), lpBuffer, PATH_BUFFER_LENGTH, path.c_str() ); if (!nBufferLength) return false; value = lpBuffer; return true;}
开发者ID:witwall,项目名称:planetariumfd,代码行数:35,
示例16: win32_add_one_solibstatic voidwin32_add_one_solib (const char *name, CORE_ADDR load_addr){ char buf[MAX_PATH + 1]; char buf2[MAX_PATH + 1];#ifdef _WIN32_WCE WIN32_FIND_DATA w32_fd; WCHAR wname[MAX_PATH + 1]; mbstowcs (wname, name, MAX_PATH); HANDLE h = FindFirstFile (wname, &w32_fd);#else WIN32_FIND_DATAA w32_fd; HANDLE h = FindFirstFileA (name, &w32_fd);#endif /* The symbols in a dll are offset by 0x1000, which is the offset from 0 of the first byte in an image - because of the file header and the section alignment. */ load_addr += 0x1000; if (h == INVALID_HANDLE_VALUE) strcpy (buf, name); else { FindClose (h); strcpy (buf, name);#ifndef _WIN32_WCE { char cwd[MAX_PATH + 1]; char *p; if (GetCurrentDirectoryA (MAX_PATH + 1, cwd)) { p = strrchr (buf, '//'); if (p) p[1] = '/0'; SetCurrentDirectoryA (buf); GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p); SetCurrentDirectoryA (cwd); } }#endif }#ifndef _WIN32_WCE if (strcasecmp (buf, "ntdll.dll") == 0) { GetSystemDirectoryA (buf, sizeof (buf)); strcat (buf, "//ntdll.dll"); }#endif#ifdef __CYGWIN__ cygwin_conv_path (CCP_WIN_A_TO_POSIX, buf, buf2, sizeof (buf2));#else strcpy (buf2, buf);#endif loaded_dll (buf2, load_addr);}
开发者ID:phausler,项目名称:binutils,代码行数:60,
示例17: ShowOpenFileDialogbool ShowOpenFileDialog(char* FileName, int FileNameLength, char* filter)// Open a dialog for selecting a file and returns true if succeeded with the name of the file in the preallocated buffer <FileName>{ OPENFILENAMEA ofn ; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = GetActiveWindow(); ofn.lpstrDefExt = 0; FileName[0] = '/0'; ofn.lpstrFile = FileName; ofn.nMaxFile = FileNameLength; ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; char strAux[MAX_PATH]; GetCurrentDirectoryA(MAX_PATH, strAux); ofn.lpstrInitialDir = strAux; ofn.lpstrTitle = LPSTR("Open File"); ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ENABLESIZING; GetOpenFileNameA(&ofn); if (strlen(ofn.lpstrFile) == 0) return false; return true;} // ShowOpenFileDialog
开发者ID:alhunor,项目名称:projects,代码行数:26,
示例18: injectThreadvoid injectThread(const wchar_t *processName) { while (true) { // Wait for process to load. wprintf(L"Waiting for %s to load.../n", processName); DWORD dwProcessId = NULL; do { Sleep(10); dwProcessId = getProcessId(processName); } while (dwProcessId == NULL); // Attempt to inject DLL. char dllFile[MAX_PATH]; GetCurrentDirectoryA(sizeof(dllFile), dllFile); sprintf(dllFile, "%s//..//Hook//bin//Hook.dll", dllFile); printf("Found PID %d, attempting to inject DLL... ", dwProcessId); if (injectDll(dwProcessId, dllFile)) { printf("done!/n"); } // Now wait for it to unload. do { Sleep(10); dwProcessId = getProcessId(processName); } while (dwProcessId != NULL); }}
开发者ID:danslo,项目名称:Celect,代码行数:26,
示例19: PlatformChangeDirectoryToResourcesvoid PlatformChangeDirectoryToResources(){ char buffer[MAX_PATH]; GetCurrentDirectoryA(MAX_PATH, buffer); lstrcatA(buffer, TEXT("//..")); SetCurrentDirectoryA(buffer);}
开发者ID:Shtille,项目名称:ShtilleEngine,代码行数:7,
示例20: test_define_dos_deviceAstatic void test_define_dos_deviceA(void){ char drivestr[3]; char buf[MAX_PATH]; DWORD ret; /* Find an unused drive letter */ drivestr[1] = ':'; drivestr[2] = 0; for (drivestr[0] = 'a'; drivestr[0] <= 'z'; drivestr[0]++) { ret = QueryDosDeviceA( drivestr, buf, sizeof(buf)); if (!ret) break; } if (drivestr[0] > 'z') { skip("can't test creating a dos drive, none available/n"); return; } /* Map it to point to the current directory */ ret = GetCurrentDirectoryA(sizeof(buf), buf); ok(ret, "GetCurrentDir/n"); ret = DefineDosDeviceA(0, drivestr, buf); todo_wine ok(ret, "Could not make drive %s point to %s!/n", drivestr, buf); if (!ret) { skip("can't test removing fake drive/n"); } else { ret = DefineDosDeviceA(DDD_REMOVE_DEFINITION, drivestr, NULL); ok(ret, "Could not remove fake drive %s!/n", drivestr); }}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:33,
示例21: good1/* good1() uses if(STATIC_CONST_FALSE) instead of if(STATIC_CONST_TRUE) */static void good1(){ if(STATIC_CONST_FALSE) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { { /* FIX: ensure MAX_PATH allocated in 'path' */ char path[MAX_PATH]; DWORD length; length = GetCurrentDirectoryA(MAX_PATH, path); if (length == 0 || length >= MAX_PATH) { exit(1); /* failure conditions for this API call */ } if (!PathAppendA(path, "AAAAAAAAAAAA")) { exit(1); } printLine(path); } }}
开发者ID:maurer,项目名称:tiamat,代码行数:27,
示例22: BotCfg_OnSavevoid BotCfg_OnSave( HWND hDlg, BotCfgDlgSt *st ){ // change subdir to './configs' char curDir[256] = {0}; char newDir[256] = {0}; GetCurrentDirectoryA( 200, curDir ); wsprintfA( newDir, "%s//configs", curDir ); SetCurrentDirectoryA( newDir ); // char fileName[256] = {0}; OPENFILENAMEA ofn; memset( &ofn, 0, sizeof(ofn) ); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hDlg; ofn.hInstance = g_hInst; ofn.lpstrFilter = "Config files/0*.config/0All files/0*.*/0/0"; ofn.lpstrFile = fileName; ofn.nMaxFile = 255; ofn.lpstrTitle = "Куда сохранять?"; ofn.lpstrInitialDir = newDir; ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; if( GetSaveFileNameA( &ofn ) ) { if( strstr( fileName, ".config" ) == NULL ) strcat( fileName, ".config" ); if( !st->myCfg.saveConfig( fileName ) ) { MessageBox( hDlg, TEXT("Конфиг не сохранился!"), TEXT("Ашыпка!"), MB_ICONSTOP ); } } // restore cur dir (required to load maps, for example) SetCurrentDirectoryA( curDir );}
开发者ID:minlexx,项目名称:l2-unlegits,代码行数:32,
示例23: m_Mode KeziaResourceManager::KeziaResourceManager(ResourceManagerMode mode) : m_Mode(mode), m_PreferredResourceManager(nullptr), m_SecondaryResourceManager(nullptr) { char tmp[255]; GetCurrentDirectoryA(255, tmp); std::string currentDirectory(tmp); switch(m_Mode) { case PreferData: m_SecondaryResourceManager = new zlib_ResourceManager(); m_SecondaryResourceManager->AddSourceDirectory(currentDirectory + "//Data.zip"); case DataOnly: m_PreferredResourceManager = new Windows_ResourceManager(); m_PreferredResourceManager->AddSourceDirectory(currentDirectory + "//Data"); break; case PreferArchive: m_SecondaryResourceManager = new Windows_ResourceManager(); m_SecondaryResourceManager->AddSourceDirectory(currentDirectory + "//Data"); case ArchiveOnly: m_PreferredResourceManager = new zlib_ResourceManager(); m_PreferredResourceManager->AddSourceDirectory(currentDirectory + "//Data.zip"); break; } }
开发者ID:kWickert,项目名称:Kezia,代码行数:28,
示例24: mainint main(int argc, char *argv[]){ #ifdef __WIN32 // Create the application's console if ( AllocConsole() == 0 ) { ::MessageBox( 0, L"Can't allocate console!/n", L"** FCS_analyzer **", MB_OK | MB_ICONSTOP ); return false; } //(?) add better error handling code later... freopen( "CON", "w", stderr); freopen( "CON", "w", stdout);// std::ios::sync_with_stdio(); // This is often nifty to know... char* cwd = new char[ MAX_PATH + 1 ]; GetCurrentDirectoryA( MAX_PATH, cwd ); std::cout << "CWD = " << cwd << std::endl; delete [] cwd; #endif //__WIN32 //QApplication a(argc, argv); QApplication app(argc, argv); Program * okno = new Program; okno->show(); app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) ); int app_rv = app.exec(); return app_rv;}
开发者ID:marras,项目名称:FCS-analyzer,代码行数:31,
示例25: ResolveIgniteHome std::string ResolveIgniteHome(const std::string* path, bool* found) { if (path) // 1. Check passed argument. return ResolveIgniteHome0(*path, false, found); else { // 2. Check environment variable. bool envFound; std::string env = GetEnv(IGNITE_HOME, &envFound); if (envFound) return ResolveIgniteHome0(env, false, found); // 3. Check current work dir. const DWORD curDirLen = GetCurrentDirectory(0, NULL); char* curDir = new char[curDirLen]; GetCurrentDirectoryA(curDirLen, curDir); std::string curDirStr = curDir; delete[] curDir; return ResolveIgniteHome0(curDirStr, true, found); } }
开发者ID:Anackreon,项目名称:ignite,代码行数:28,
示例26: create_test_filesstatic void create_test_files(void){ int len; GetCurrentDirectoryA(MAX_PATH, CURR_DIR); len = lstrlenA(CURR_DIR); if(len && (CURR_DIR[len-1] == '//')) CURR_DIR[len - 1] = 0; get_program_files_dir(PROG_FILES_DIR); CreateDirectoryA("msitest", NULL); create_file("msitest//one.txt"); CreateDirectoryA("msitest//first", NULL); create_file("msitest//first//two.txt"); CreateDirectoryA("msitest//second", NULL); create_file("msitest//second//three.txt"); create_file("four.txt"); create_file("five.txt"); create_cab_file("msitest.cab"); DeleteFileA("four.txt"); DeleteFileA("five.txt");}
开发者ID:howard5888,项目名称:wineT,代码行数:26,
示例27: AddPackagePath/* AddPackagePath().*/static int c_AddPackagePath( lua_State *_pState ){ const char *packagePath = luaL_checkstring( _pState, 1 ); bool bRelative = true; if( lua_isboolean( _pState, 2 ) ) if( lua_toboolean( _pState, 2 ) == 0 ) bRelative = false; char dirBuf[ MAX_PATH + 1];#if defined(WIN32) && defined(_MSC_VER) std::string dir; if (GetCurrentDirectoryA(sizeof(dirBuf) - 1, dirBuf)) dir = dirBuf;#else std::string dir = getcwd( &dirBuf[0], MAX_PATH + 1 );#endif if( bRelative ) dir += packagePath; else dir = packagePath; Call( _pState, "AddInstallation", "s", (const char *)dir.c_str() ); return( 0 );}
开发者ID:DArtagan,项目名称:electricsheep,代码行数:32,
示例28: readIniFilevoid readIniFile(){ char Buffer[128]; char iniFilePath[MAX_PATH]; GetCurrentDirectoryA(sizeof(iniFilePath), iniFilePath); lstrcatA(iniFilePath, "//multidisk_speed.ini"); IPC_getPrivateProfileString("Option", "DriveCnt", "1", Buffer, sizeof(Buffer), iniFilePath); driveCnt = atoi(Buffer); for (int i = 0; i < driveCnt; i++) { sprintf(Buffer, "DriveName%d", i); IPC_getPrivateProfileString("Option", Buffer, "////.//H:", driveName[i], sizeof(driveName[i]), iniFilePath); } IPC_getPrivateProfileString("Option", "DriveFlag", "0", Buffer, sizeof(Buffer), iniFilePath); drvFlg = atoi(Buffer); for (int i = 0; i < driveCnt; i++) { sprintf(Buffer, "FullFileName%d", i); IPC_getPrivateProfileString("Option", Buffer, "data.bin", fileName[i], sizeof(fileName[i]), iniFilePath); } IPC_getPrivateProfileString("Option", "BufferSizeInMb", "1", Buffer, sizeof(Buffer), iniFilePath); bBufSize = atoi(Buffer) * 1024 * 1024; IPC_getPrivateProfileString("Option", "BufferNum", "1", Buffer, sizeof(Buffer), iniFilePath); bufCnt = atoi(Buffer); IPC_getPrivateProfileString("Option", "BufferStatistic", "0", Buffer, sizeof(Buffer), iniFilePath); bufStat = atoi(Buffer);}
开发者ID:andorok,项目名称:Utilities,代码行数:32,
示例29: SaveFileDialogstring_t SaveFileDialog(const char *title, const char *filter) { OPENFILENAMEA ofn; char szPath[MAX_PATH]; char szFile[MAX_PATH]; memset(&ofn, 0, sizeof(ofn)); memset(szPath, 0, sizeof(szPath)); memset(szFile, 0, sizeof(szFile)); GetCurrentDirectoryA(MAX_PATH, szPath); char *fixuped_filter = fixup_filter(filter); ofn.lStructSize = sizeof(OPENFILENAMEA); ofn.hwndOwner = NULL; ofn.lpstrInitialDir = szPath; ofn.lpstrFile = szFile; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = fixuped_filter; ofn.lpstrTitle = title; ofn.Flags = OFN_EXPLORER | OFN_OVERWRITEPROMPT; if (GetSaveFileNameA(&ofn)) { free(fixuped_filter); return String.Create(szFile); } else { free(fixuped_filter); return String.Create(NULL); }}
开发者ID:Sup3rc4l1fr4g1l1571c3xp14l1d0c10u5,项目名称:NanoGL,代码行数:30,
示例30: GetCurrentDirectoryAOptions::Options() { char directory[MAX_PATH]; configPath = ""; GetCurrentDirectoryA(MAX_PATH, directory); configPath.append(directory).append("//config.ini");}
开发者ID:PyatkinAleksey,项目名称:ftp_client_gui,代码行数:7,
注:本文中的GetCurrentDirectoryA函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetCurrentDirectoryW函数代码示例 C++ GetCurrentDirectory函数代码示例 |