• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetCurrentDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetCurrentDir函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentDir函数的具体用法?C++ GetCurrentDir怎么用?C++ GetCurrentDir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetCurrentDir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetCurrentDirC

char* GetCurrentDirC(void)
{
    static char dir[1024];
    memcpy(dir, GetCurrentDir().c_str(), GetCurrentDir().length() + 1);

    return dir;
}
开发者ID:XadillaX,项目名称:deathoj,代码行数:7,代码来源:NBUTOJCore.cpp


示例2: GetCurrentDir

SelectFileScreen::SelectFileScreen()
{
	char cCurrentPath[FILENAME_MAX];
	GetCurrentDir(cCurrentPath, sizeof(cCurrentPath));

	m_DirString = Stringc(cCurrentPath);

	char forwardSlash = '\\';
	m_DirString.change_from_to(forwardSlash, '/');

	int dirSize = m_DirString.get_length();
	if ( m_DirString[dirSize-1] != '/' )
		m_DirString.concatenate("/");

	m_FilterString = Stringc("*.*");

	selectFileUI = new SelectFileUI();
	selectFileUI->UIWindow->position( 30, 30 );
	selectFileUI->fileBrowser->type(FL_SELECT_BROWSER);
	selectFileUI->fileBrowser->callback( staticScreenCB, this );
	selectFileUI->dirInput->callback( staticScreenCB, this );
	selectFileUI->dirInput->when(FL_WHEN_CHANGED);

	selectFileUI->fileInput->callback( staticScreenCB, this );
	selectFileUI->acceptButton->callback( staticScreenCB, this );
	selectFileUI->cancelButton->callback( staticScreenCB, this );

	selectFileUI->favsMenuButton->callback( staticScreenCB, this );

	LoadFavsMenu();
}
开发者ID:KubaO,项目名称:OpenVSP,代码行数:31,代码来源:selectFileScreen.cpp


示例3: getBase

std::string empathy::getBase()
{
    char cCurrentPath[FILENAME_MAX];

    if(__base==""){

        if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
        {
            __base= "";

            std::cout<<"Error setting base Directory!"<<std::endl;
        }else{
            cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */

            __base=join_path(std::string(cCurrentPath),"empathy");

            std::cout<<"Base changed to "<<__base<<std::endl;
        }




    }


    return __base;
}
开发者ID:underscoredam,项目名称:empathy,代码行数:27,代码来源:global.cpp


示例4: getPath

std::string getPath()
{
    std::string fullpath;
    // ----------------------------------------------------------------------------
    // This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
#ifdef __APPLE__
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
    char path[PATH_MAX];
    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
    {
        // error!
    }
    CFRelease(resourcesURL);
    chdir(path);
    fullpath = path;
#else
	 char cCurrentPath[1024];
	 if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
		 return "";

	cCurrentPath[sizeof(cCurrentPath) - 1] = '\0';
	fullpath = cCurrentPath;

#endif    
    return fullpath;
}
开发者ID:jagenjo,项目名称:TJE_Framework,代码行数:27,代码来源:utils.cpp


示例5: TIniFile

//---------------------------------------------------------------------------
void __fastcall CTerminalRobotTyper::RestoreKeyInterval(){
   	TIniFile *ini = new TIniFile(GetCurrentDir() + "\\app.ini");
	int keyInterval = ini->ReadInteger(terminal->xmlConfig->TerminalID , "KeyboardInterval", terminal->panel->TrackBarKey->Position);
    delete ini;
	terminal->panel->TrackBarKey->Position =keyInterval;
    keyIntervalRestored =true;
}
开发者ID:limitee,项目名称:bot,代码行数:8,代码来源:TerminalRobotTyper.cpp


示例6: DosWowSetDefaultDrive

ULONG DosWowSetDefaultDrive(UCHAR Drive)
{
    PCDS pCDS;

    if (NULL != (pCDS = GetCDSFromDrv (Drive))) {

        if (GetCurrentDir (pCDS, Drive)) {

            if (*(PUCHAR)DosWowData.lpCurDrv != Drive) {

                // The upper bit in the TDB_Drive byte is used to indicate
                // that the current drive and directory information in the
                // TDB is stale. Turn it off here.
                PTDB pTDB;
                if (*pCurTDB) {
                    pTDB = (PTDB)SEGPTR(*pCurTDB,0);
                    if (TDB_SIGNATURE == pTDB->TDB_sig) {
                        pTDB->TDB_Drive &= ~TDB_DIR_VALID;
                    }
                }

                *(PUCHAR)DosWowData.lpCurDrv = Drive;
            }

        }
    }

    return (*(PUCHAR)DosWowData.lpCurDrv);

}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:30,代码来源:wdos.c


示例7: LoadTexture

	unsigned int LoadTexture(const std::string& dataPath)
	{
		glEnable(GL_TEXTURE_2D);

		std::string fPath = GetCurrentDir(); // Get current directory, SOIL doesn't seem to work from executable directory

		fPath.append("img\\" + dataPath);

		unsigned int tex_2d = SOIL_load_OGL_texture
			(
			fPath.c_str(),
			SOIL_LOAD_AUTO,
			SOIL_CREATE_NEW_ID,
			SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
			);

		if (tex_2d == 0)
		{
			std::string s = "\n\n---- SOIL ERROR ----\nFilename: " + fPath;
			s.append("\nSOIL Message: ");
			s.append(SOIL_last_result());
			s.append("\n\n");

			Log::Write(s.c_str(), ENGINE_LOG);
		}

		glBindTexture(GL_TEXTURE_2D, tex_2d);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glBindTexture(GL_TEXTURE_2D, 0);

		glDisable(GL_TEXTURE_2D);

		return tex_2d;
	}
开发者ID:hkeeble,项目名称:Pinball,代码行数:35,代码来源:loadImage.cpp


示例8: main

int main(int argc, char* argv[]){

	int exitCode = psm::StatusNoError;

	char cCurrentPath[FILENAME_MAX];

	cCurrentPath[sizeof(cCurrentPath)-1] = '\0'; /* not really required */

	if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
	{
		return errno;
	}

	printf("The current working directory is %s", cCurrentPath);

	psm::IApp * app = new(std::nothrow) PSMAPP();

	app->processArguments(argc, argv);

	exitCode = app->run();

	delete app;

	app = nullptr;

	return exitCode;
}
开发者ID:Ostkaka,项目名称:PSM,代码行数:27,代码来源:main.cpp


示例9: main

int main()
{
     FILE * f;
     char fname[FILENAME_MAX] = "log_testClassPoint.txt";
     char cCurrentPath[FILENAME_MAX];
     f = fopen(fname, "w");
     if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath))) {
          return EXIT_FAILURE;
     }
     cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */

     fprintf (f, "The current working directory is %s\n\n", cCurrentPath);

     int res = 0, ntests = 0;

     res += testNorm(f);
     ntests++;
     res += testNormalized(f);
     ntests++;
     res += testScalarP(f);
     ntests++;
     res += testDet(f);
     ntests++;
     res += testCoordTransToEllipse(f);
     ntests++;
     res += testCoordTransToCart(f);
     ntests++;
     res += testRotate(f);
     ntests++;

     fclose(f);
     return (res==ntests)?EXIT_SUCCESS:EXIT_FAILURE;
}
开发者ID:kaelonlloyd,项目名称:jpscore,代码行数:33,代码来源:testClassPoint.cpp


示例10: get_working_dir

//get_working_dir
std::string get_working_dir()
{
	char buff[FILENAME_MAX];
	GetCurrentDir(buff, FILENAME_MAX);
	std::string current_working_dir(buff);
	return current_working_dir;
}
开发者ID:besh81,项目名称:nana-creator,代码行数:8,代码来源:filemanager.cpp


示例11: FindRoot

// On success, currdir_relative_to_root will be a canonical path.
Res FindRoot(string* absolute_root,
             string* currdir_relative_to_root) {
  string currdir = GetCurrentDir();

  // Look for root dir.  Root dir is marked by the presence of a
  // "root.dmb" file.
  string root = currdir;
  for (;;) {
    if (FileExists(PathJoin(root, "root.dmb"))) {
      break;
    }
    if (HasParentDir(root)) {
      root = ParentDir(root);
    } else {
      return Res(ERR, "Can't find root.dmb in ancestor directories");
    }
  }
  *absolute_root = root;

  const char* remainder = currdir.c_str() + root.length();
  if (remainder[0] == '/') {
    remainder++;
  }
  *currdir_relative_to_root = remainder;
  assert(currdir_relative_to_root->size() == 0 ||
         (*currdir_relative_to_root)[currdir_relative_to_root->length() - 1]
         != '/');

  return Res(OK);
}
开发者ID:prepare,项目名称:gameswf,代码行数:31,代码来源:dumbuild.cpp


示例12: isAbsolute

 // remove any . or .. and make absolute if necessary
 Path& Path::normalize() {
   size_t i = 0;
   bool wasMadeAbsolute = isAbsolute();
   while (i < mPaths.size()) {
     if (mPaths[i] == ".") {
       mPaths.erase(mPaths.begin()+i);
     } else if (mPaths[i] == "..") {
       if (i == 0) {
         if (wasMadeAbsolute) {
           // invalid path
           mPaths.clear();
           break;
         }
         Path cwd = GetCurrentDir();
         cwd.pop();
         size_t sz = cwd.mPaths.size();
         mPaths.erase(mPaths.begin()+i);
         mPaths.insert(mPaths.begin(), cwd.mPaths.begin(), cwd.mPaths.end());
         i = sz;
         wasMadeAbsolute = true;
       } else {
         mPaths.erase(mPaths.begin()+i);
         mPaths.erase(mPaths.begin()+i-1);
         --i;
       }
     } else {
       ++i;
     }
   }
   mFullName = fullname(DIR_SEP);
   return *this;
 }
开发者ID:gatgui,项目名称:gcore,代码行数:33,代码来源:path.cpp


示例13: WriteDatFile

//----------------
//
void WriteDatFile( TYPE_File *writeFile )
{
    char* currentDir;
     
    appendToLogfile("WriteDatFile: Started.", INFO);
    appendToLogfile("WriteDatFile: GetCurrentDir called.", WARNING);
    currentDir = GetCurrentDir();  // Store the current  directory.

    appendStringToLogfile("WriteDatFile: GetCurrentDir returned=%s.",currentDir, WARNING);
    appendStringToLogfile("WriteDatFile: Moving to=%s.",TAPIniDir, WARNING);
    GotoPath(TAPIniDir);           // Go to the Project Directory.
    
	if ( TAP_Hdd_Exist( PLAYDATA_FILENAME ) ) TAP_Hdd_Delete( PLAYDATA_FILENAME );	// Just delete any old copies

    appendToLogfile("WriteDatFile: Creating DATA file.", ERR);
	TAP_Hdd_Create( PLAYDATA_FILENAME, ATTR_PROGRAM );						// Create the file

    appendToLogfile("WriteDatFile: Opening DATA file.", ERR);
	writeFile = TAP_Hdd_Fopen( PLAYDATA_FILENAME );
	if ( writeFile == NULL ) return; 										// Check we can open it

    appendToLogfile("WriteDatFile: Writing to DATA file.", ERR);
	TAP_Hdd_Fwrite( playDataBuffer_ini, PLAYBACKDATA_BUFFER_SIZE_ini, 1, writeFile );	// dump the whole buffer in one hit

    appendToLogfile("WriteDatFile: Closing DATA file.", ERR);
	TAP_Hdd_Fclose( writeFile );

    appendStringToLogfile("WriteDatFile: Returning to=%s.",currentDir, WARNING);
	GotoPath(currentDir);            // Return to the original directory.

    TAP_MemFree( currentDir );   // Free allocated memory.
    
    appendToLogfile("WriteDatFile: Finished.", INFO);
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:36,代码来源:PlaybackDatFile.c


示例14: getCurrentDir

std::string getCurrentDir() {
    char cCurrentPath[FILENAME_MAX];
    if (!GetCurrentDir(cCurrentPath, sizeof (cCurrentPath))) {
        return std::string(itoa(errno));
    }
    cCurrentPath[sizeof (cCurrentPath) - 1] = '\0'; /* not really required */
    return std::string(cCurrentPath);
}
开发者ID:ferryfair,项目名称:ferryport,代码行数:8,代码来源:mystdlib.cpp


示例15: GetCurrentDir

HRESULT CZZExcel2Word::InitExportSettings()
{
	std::wstring curdir = GetCurrentDir();
	std::wstring initFilePath;
	m_stringWordTemplatePath = curdir + Template_FILE_NAME;
	initFilePath = curdir+INI_FILE_NAME;
	return InitExportSettings(initFilePath.c_str());
}
开发者ID:snowendless,项目名称:ZZClasses,代码行数:8,代码来源:ZZExcel2Word.cpp


示例16: saveAs_activate_cb

/*  --------------------------------------------------------  */
void Menu::saveAs_activate_cb()
{
    if(!this->saveAsFile)
        Log::LogWarn(LEVEL_LOG_INFO, "Unable to load open window", __FILE__, __LINE__);

    this->saveAsFile->set_current_folder(GetCurrentDir());
    this->saveAsFile->run();
}
开发者ID:abyoussef,项目名称:X-CubeSat,代码行数:9,代码来源:menu.cpp


示例17: GetCurrentDir

 // if path is relative, prepend current directory
 Path& Path::makeAbsolute() {
   if (!isAbsolute()) {
     Path cwd = GetCurrentDir();
     mPaths.insert(mPaths.begin(), cwd.mPaths.begin(), cwd.mPaths.end());
     mFullName = fullname(DIR_SEP);
   }
   return *this;
 }
开发者ID:gatgui,项目名称:gcore,代码行数:9,代码来源:path.cpp


示例18:

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
 start=1;
 mode=0;
 Dir_for_file=GetCurrentDir();
 start_form_ini(Form1);
 start=0;
}
开发者ID:D3vills,项目名称:Programm,代码行数:9,代码来源:Unit1.cpp


示例19: GetCurrentWorkingDir

std::string GetCurrentWorkingDir(void) {
  char buff[FILENAME_MAX];
  auto result = GetCurrentDir(buff, FILENAME_MAX);
  if (result) {
    std::string current_working_dir(buff);
    return current_working_dir;
  }
  return "";
}
开发者ID:ERGO-Code,项目名称:HiGHS,代码行数:9,代码来源:TestFilereader.cpp


示例20: GetWorkingDirectory

std::string GetWorkingDirectory()
{
  if (!GetCurrentDir(cCurrentPath, sizeof(cCurrentPath)))
  {
    return "";
  }
  cCurrentPath[sizeof(cCurrentPath) - 1] = '\0'; /* not really required */
  return cCurrentPath;
}
开发者ID:krishauser,项目名称:KrisLibrary,代码行数:9,代码来源:fileutils.cpp



注:本文中的GetCurrentDir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetCurrentDirectory函数代码示例发布时间:2022-05-30
下一篇:
C++ GetCurrentContext函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap