您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetCurrentDir函数代码示例

51自学网 2021-06-01 21:05:55
  C++
这篇教程C++ GetCurrentDir函数代码示例写得很实用,希望能帮到您。

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

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

示例1: GetCurrentDirC

char* GetCurrentDirC(void){    static char dir[1024];    memcpy(dir, GetCurrentDir().c_str(), GetCurrentDir().length() + 1);    return dir;}
开发者ID:XadillaX,项目名称:deathoj,代码行数:7,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例10: get_working_dir

//get_working_dirstd::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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: fread

//---------------------------------------------------------------------------void __fastcall TForm1::Button5Click(TObject *Sender){ AnsiString cd; FILE *f; int i; dword curpos; if(OpenDialog->Execute()) {  cd=GetCurrentDir()+"//";  default_txt=   OpenDialog->FileName.SubString(cd.Length()+1,OpenDialog->FileName.Length()-cd.Length());  Timer->Enabled=true;  f=fopen(OpenDialog->FileName.c_str(),"rb+");  Log->Clear();  //Заголовок  Log->Lines->Add("Чтение заголовка...");  fread(BookHeader,sizeof(BookHeader),1,f);  Title->Text="";  for(i=0;i<64;i++)Title->Text=Title->Text+(char)BookHeader[i];  Author->Text="";  for(i=64;i<224;i++)Author->Text=Author->Text+(char)BookHeader[i];  //Количество страниц  Log->Lines->Add("Чтение количества страниц...");  fread(&PagesCount,sizeof(PagesCount),1,f);  CurrentPage=1;  PC->Caption=IntToStr(PagesCount);  CP->Caption=IntToStr(CurrentPage);  PCMax->Value=PagesCount;  //Адреса страниц  Log->Lines->Add("Чтение адресов страниц...");  fread(PageAddress,sizeof(dword)*PagesCount,1,f);  curpos=ftell(f);  fseek(f,0,SEEK_END);  PageAddress[PagesCount]=ftell(f);  fseek(f,curpos,SEEK_SET);  //Размер страниц  Log->Lines->Add("Подсчет размеров страниц...");  for(i=0;i<PagesCount;i++)PageSize[i]=PageAddress[i+1]-PageAddress[i];  //Страницы  Log->Lines->Add("Чтение содержимого страниц...");  for(i=0;i<PagesCount;i++)  {   fseek(f,PageAddress[i],SEEK_SET);   fread(Page[i],sizeof(byte)*PageSize[i],1,f);   Application->ProcessMessages();  }  Log->Lines->Add("Чтение документа "+OpenDialog->FileName+" завершено.");  Form1->Caption="TES: Daggerfall Book Editor { "+OpenDialog->FileName+" }";  Timer->Enabled=false;  fclose(f);  SpeedButton3Click(NULL);  SaveDialog->FileName=OpenDialog->FileName;  Form1->Caption="TES2:Daggerfall Books-files Editor { "+default_txt+" }";  Application->Title="{ "+default_txt+" }"; }}
开发者ID:old-games,项目名称:Daggerfall-Localization-Tools,代码行数:57,


示例22: new

void __fastcall TfMain::FormShow(TObject *Sender){	TStringList* sl = new(TStringList);	sl->NameValueSeparator = '=';	TFile f;	if(f.Exists(ExtractFileDir(Application->ExeName) + "//Library.lb")){		sl->LoadFromFile(GetCurrentDir() + "//Library.lb");		for(int i = 0; i < sl->Count; i++){			TListItem* Item = lvLib->Items->Add();			Item->Caption = ExtractFileName(sl->Names[i]);			Item->GroupID = 0;			Item->SubItems->Add(sl->Names[i]); //path [0]			TStringList* ss = new(TStringList);			ss->NameValueSeparator = '/';			ss->Add(sl->ValueFromIndex[i]);			Item->SubItems->Add(ss->Names[0]); //bookmark [1]			Item->SubItems->Add(ss->ValueFromIndex[0]); //size [2]			ss->~TStringList();		}	}	sl->Clear();	if(f.Exists(ExtractFileDir(Application->ExeName) + "//Settings.ini")){		sl->LoadFromFile(GetCurrentDir() + "//Settings.ini");		leLogin->Text = sl->ValueFromIndex[0];		lePass->Text = sl->ValueFromIndex[1];		if(sl->ValueFromIndex[2] == "1")			cbRememberPass->Checked = true;		else            cbRememberPass->Checked = false;		leServer->Text = sl->ValueFromIndex[3];	}	sl->~TStringList();}
开发者ID:szavalishin,项目名称:Libs,代码行数:43,


示例23: HGPU_io_path_get

// get pathvoidHGPU_io_path_get(char** path){    if (!path) HGPU_error(HGPU_ERROR_ARRAY_OUT_OF_BOUND);    size_t path_length = HGPU_FILENAME_MAX;    char* path_new = *path;    if (!path_new) HGPU_string_resize(&path_new,path_length);    if (!GetCurrentDir(path_new,(int) path_length)) HGPU_error_message(HGPU_ERROR_DEVICE_INITIALIZATION_FAILED,"could not obtain inf path");    HGPU_io_path_set_separator(&path_new,path_length);    *path = path_new;}
开发者ID:vadimdi,项目名称:PRNGCL,代码行数:11,


示例24: GetParentDir

SetDirectory::SetDirectory(const char* filename){    directory = GetParentDir(filename);    if (!directory.empty())    {        previousDir = GetCurrentDir();        if (chdir(directory.c_str()) != 0)            msg_error("SetDirectory") << "can't change directory.";    }}
开发者ID:FabienPean,项目名称:sofa,代码行数:10,


示例25: get_current_working_directory

    std::string get_current_working_directory()    {        std::string cwd(256, '/0'); //todo: use a max_filepath macro        GetCurrentDir(&cwd[0], cwd.length()); //suposedly grabbing the address of std::string[0] works in c++11 onwards        size_t new_size = 0;        for (; cwd[new_size] != '/0'; ++new_size);        cwd.resize(new_size);        return cwd;    }
开发者ID:mflagel,项目名称:asdf_multiplat,代码行数:10,


示例26: muodostaTiedostopolku

/* * muodostaTiedostopolku - muodostaa tiedostpolun ty
C++ GetCurrentDirectory函数代码示例
C++ GetCurrentContext函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。