本文整理汇总了C++中ExtractFileName函数的典型用法代码示例。如果您正苦于以下问题:C++ ExtractFileName函数的具体用法?C++ ExtractFileName怎么用?C++ ExtractFileName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExtractFileName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
//-----------------------------------------------------------------------------
const char *dcb_p32_imgd_state(GUI_MENU_ENTRY *ptr)
{
const char *ret = NULL;
switch (ptr->action & 0x3FFF) {
case 1:
ptr->state = Settings->PMD32->driveA.writeProtect;
ret = ExtractFileName(Settings->PMD32->driveA.image);
break;
case 2:
ptr->state = Settings->PMD32->driveB.writeProtect;
ret = ExtractFileName(Settings->PMD32->driveB.image);
break;
case 3:
ptr->state = Settings->PMD32->driveC.writeProtect;
ret = ExtractFileName(Settings->PMD32->driveC.image);
break;
case 4:
ptr->state = Settings->PMD32->driveD.writeProtect;
ret = ExtractFileName(Settings->PMD32->driveD.image);
break;
default:
break;
}
return ret;
}
示例2:
//---------------------------------------------------------------------------
void __fastcall TForm1::openOutput1Click(TObject *Sender)
{// open output
if (OpenDialog1->Execute())
{
Table2->Active=false;
fileout=OpenDialog1->FileName;
if (FileExists(fileout))
{
AnsiString filename2=ExtractFileName(fileout);
// if(Session->IsAlias(filename2))
// {
// Table2->DatabaseName=filename2;
// Table2->TableName=filename2;
// }
// else
// {
// Session->AddStandardAlias(filename2,ExtractFilePath(fileout),"");
// }
// Table2->Active=true;
// Table2->TableType=ttDBase;
Table2->DatabaseName=ExtractFilePath(fileout);//filename2;
Table2->TableName=ExtractFileName(fileout);
Table2->Active=true;
}
}
}
示例3: ChangeFileExt
//---------------------------------------------------------------------------
void __fastcall TFormMain::ExportCFileClick(TObject *Sender)
{
if (ExportDialog->Execute())
{
TStringList* SL = new TStringList;
__try
{
ChangeFileExt(ExtractFileName(ExportDialog->FileName), "");
SL->Add(Format("YETI_ROM rom_map_t %s = {", ARRAYOFCONST((
ChangeFileExt(ExtractFileName(ExportDialog->FileName), "")))));
SL->Add(Format("\"%s\",\"%s\",\"%s\",{", ARRAYOFCONST((
"Test Map",
"Derek J. Evans",
"Welcome to Yeti3D"))));
for (int y = 0; y < YETI_MAP_HEIGHT; y++)
{
SL->Add("{");
for (int x = 0; x < YETI_MAP_WIDTH; x++)
{
cell_t* cell = &yeti->cells[y][x];
SL->Add(Format("{%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d},", ARRAYOFCONST((
cell->swi,
cell->ent,
cell->top,
cell->mid,
cell->bot,
cell->lit,
cell->wtx,
cell->ttx,
cell->mtx,
cell->btx,
0, // Reserved 1
0 // Reserved 2
))));
}
String S = SL->Strings[SL->Count - 1];
SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
SL->Add("},");
}
String S = SL->Strings[SL->Count - 1];
SL->Strings[SL->Count - 1] = S.SubString(1, S.Length() - 1);
SL->Add("}};");
SL->SaveToFile(ExportDialog->FileName);
}
__finally
{
SL->Free();
}
}
示例4: ShowMessage
void __fastcall TMainForm::ButtonAddDocClick(TObject *Sender)
{
if (OraQueryAllJournal->RecordCount == 0)
{
ShowMessage ("Не выбрана запись !");
return;
}
Screen->Cursor = crHourGlass;
OpenDialogDocs->Filter = "All files (*.*)|*.*||";
if (OpenDialogDocs->Execute())
{
for (int i = 0; i < OpenDialogDocs->Files->Count; i++)
{
OraQueryDocsInsert->SQL->Text = "SELECT DOC_NAME FROM " + m_shema + "." + m_blob_table + " WHERE DOC_NAME = '" +
ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str()) +
"' AND " + m_blob_foreign_key + " = " + OraQueryAllJournal->Fields->FieldByName(m_primary_key)->AsString;
OraQueryDocsInsert->Open();
if (OraQueryDocsInsert->RecordCount)
{
ShowMessage ("Файл " + ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str()) + " уже существует !");
OraQueryDocsInsert->Close();
continue;
}
OraQueryDocsInsert->Close();
OraQueryDocsInsert->SQL->Clear();
OraQueryDocsInsert->Open();
OraQueryDocsInsert->Insert();
TFields *fields = OraQueryDocsInsert->Fields;
TBlobField *t = (TBlobField*)(fields->FieldByName("DOC_TEXT"));
t->LoadFromFile(OpenDialogDocs->Files->Strings[i].c_str());
OraQueryDocsInsert->FieldValues [m_blob_foreign_key] = OraQueryAllJournal->Fields->FieldByName (m_primary_key)->AsString;
OraQueryDocsInsert->FieldValues ["DOC_NAME"] = ExtractFileName(OpenDialogDocs->Files->Strings[i].c_str());
OraQueryDocsInsert->Post();
OraQueryDocsInsert->Close();
}
}
OraQueryDocs->Close();
OraQueryDocs->Open();
Screen->Cursor = crDefault;
}
示例5: ExtractFileExt
void doc2txt::convertPro(AnsiString WordFile,AnsiString PathPutTxt)
{
TStringList* word=new TStringList;
String filename = WordFile;
Variant vVarApp,vVarDoc,vVarParagraphs,vVarParagraph;
AnsiString resolution = ExtractFileExt(filename);
AnsiString str = StringReplace( ExtractFileName(filename),resolution,"",TReplaceFlags()<< rfReplaceAll << rfIgnoreCase);
try
{
vVarApp=CreateOleObject("Word.Application");
}
catch(...)
{
MessageBox(0, "Не удачно получилось открыть Word", "Внимание", MB_OK);
return;
}
vVarApp.OlePropertySet("Visible",false);
vVarDoc = vVarApp.OlePropertyGet("Documents");
vVarDoc.OleProcedure("Open", StringToOleStr(filename));
vVarDoc = vVarDoc.OleFunction("Item",1);
vVarDoc.OleProcedure("Activate");
String s = vVarDoc.OlePropertyGet("Content").OlePropertyGet("Text");
word->Add(s);
word->SaveToFile( PathPutTxt + str +".txt" );
vVarApp.OleProcedure("Quit");
delete word;
}
示例6: FindDiskFileCaseInsensitive
wxString FindDiskFileCaseInsensitive(wxString const & Filename)
{
wxString result = "";
wxString ShortFilename;
wxString CurDir;
wxDir dir;
CurDir = ExtractFilePath(Filename);
wxArrayString FileList;
dir.GetAllFiles(CurDir, &FileList, GetAllFilesMask(), wxDIR_DEFAULT);
for (size_t i = 0; i < FileList.GetCount(); i++)
{
ShortFilename = ExtractFileName(Filename);
if (CompareText(FileList[i], ShortFilename) == 0)
{
if (CompareStr(FileList[i], ShortFilename) == 0)
{
// fits exactly
result = Filename;
break;
}
// fits case insensitive
result = CurDir + FileList[i];
// search further
}
}
return result;
}
示例7: GetProcessInfoMap
//
// Note: This does not aggregate the samples
//
bool GetProcessInfoMap(CpuProfileReader& profileReader,
bool sepByCore,
gtUInt64 coreMask,
PidProcessInfoMap& procInfoMap)
{
GT_UNREFERENCED_PARAMETER(coreMask);
bool retVal = false;
gtUInt32 numCores = profileReader.getProfileInfo()->m_numCpus;
gtUInt32 dataSize = (sepByCore) ? (numCores * profileReader.getProfileInfo()->m_numEvents)
: profileReader.getProfileInfo()->m_numEvents;
PidProcessMap* procMap = profileReader.getProcessMap();
if (nullptr != procMap)
{
for (PidProcessMap::const_iterator it = procMap->begin(); it != procMap->end(); it++)
{
ProcessInfo procInfo;
ExtractFileName((*it).second.getPath(), procInfo.m_processName);
procInfo.m_pid = (*it).first;
procInfo.m_hasCSS = (*it).second.m_hasCss;
procInfo.m_is32Bit = (*it).second.m_is32Bit;
procInfo.m_dataVector.resize(dataSize);
procInfoMap.insert(PidProcessInfoMap::value_type(procInfo.m_pid, procInfo));
}
retVal = true;
}
return retVal;
}
示例8: files
void __fastcall TForm1::OpenPicture1Click(TObject *Sender)
{
OpenPictureDialog1->Filter =
"Bmp files (*.bmp)|*.BMP| JPEG images (*.jpg) | *.jpg; " ;
if (OpenPictureDialog1->Execute())
{
if (!FileExists(OpenPictureDialog1->FileName))
return;
AnsiString temp2 = ExtractFileName(OpenPictureDialog1->FileName);
AnsiString temp = ExtractFileExt(OpenPictureDialog1->FileName);
AnsiString Ext = temp.LowerCase();
if (Ext.AnsiPos("jpg") > 0)
{
TJPEGImage *myjpeg = new TJPEGImage();
myjpeg->LoadFromFile(OpenPictureDialog1->FileName);
myjpeg->DIBNeeded();
Image1->Picture->Bitmap->Assign(myjpeg);
delete myjpeg;
}
else if (Ext.AnsiPos("bmp") > 0)
{
Image1->Picture->Bitmap->LoadFromFile(OpenPictureDialog1->FileName);
}
}
{
Undo1->Enabled=false; //apenergopoioume ta undo/redo
Redo1->Enabled=false;
ToolUndo->Enabled=false;
ToolRedo->Enabled=false;
}
}
示例9: MakeDestFileName
/*
** static void MakeDestFileName(char ARG_PTR *argv[], char ARG_PTR *pszDest);
**
** Create the appropriate destination file name.
**
** Arguments: argv - like argument to main()
** pszDest - pointer to destination file name buffer to be filled
** in
**
** Returns: void
**
** Globals: none
*/
static VOID MakeDestFileName(CHAR ARG_PTR *argv[], CHAR ARG_PTR *pszDest)
{
CHAR ARG_PTR *pszDestFile;
if (nNumFileSpecs == 2 && bTargetIsDir == FALSE && bDoRename == FALSE)
// Compress a single input file to a single output file. N.b., we must
// be careful to eat up the output file name command-line argument so
// it doesn't get processed like another input file!
STRCPY(pszDest, argv[GetNextFileArg(argv)]);
else if (bTargetIsDir == TRUE)
{
// Prepend output file name with destination directory path name.
STRCPY(pszDest, pszTargetName);
// Isolate source file name from source file specification.
pszDestFile = ExtractFileName(pszInFileName);
// Add destination file name to destination directory path
// specification.
MakePathName(pszDest, pszDestFile);
}
else
// Destination file name same as source file name. N.b., this is an
// error condition if (bDoRename == FALSE).
STRCPY(pszDest, pszInFileName);
}
示例10: fclose
bool __fastcall TForm1::kcFileCheck(AnsiString FileName)
{
//TODO: Add your source code here
if (!FileExists(FileName))
return false;
AnsiString str1,str2;
FILE *fp;
if(fp=fopen(FileName.c_str(),"r")) //rt:r=只读 t=文本模式
str2=fgets(str1.c_str(),4,fp);
fclose(fp);
if(AnsiString(str2)!="01L" && AnsiString(str2)!="01B")
{
ErrorReport(ExtractFileName(FileName),0,"非接驳文件");
//ADOQuery1->SQL->Text="select * from ErrorReport";
//ADOQuery1->Open();
return false;
}
return true;
}
示例11: FileClose
//---------------------------------------------------------------------------
void __fastcall TCPRecib1::PHDS1BeforePost( TObject* Sender )
{
if( !FileExists( String( PHDS1->GV( RECIB_ARQUIVO ) ) ) )
{
FileClose( FileCreate( String( PHDS1->GV( RECIB_ARQUIVO ) ) ) );
}
if( PHDS1->State == phEdit )
{
if(W1->Documents->Count)
{
for(int f = 1; f <= W1->Documents->Count; f++)
{
if((String)W1->Documents->Item((OleVariant)f)->Name == ExtractFileName(PHDS1->GV(RECIB_ARQUIVO)))
{
/*quando o usuário deixou o word aberto e não salvou
as alterações nele, salva automaticamente e fecha o word*/
if(WordDocument1->Saved == false)
WordDocument1->Save();
W1->Disconnect();
break;
}
}
}
}
}
示例12: memset
void __fastcall TForm1::expLicExecute(TObject *Sender)
{
//
TListItem *it;
//
// remove entry
it=lst->Selected;
if(!removeLicense(localFile.c_str(),(int)it->Data,/*ignored*/1)){
return;
}
pmc_license_t lic;
memset(&lic, 0, sizeof lic);
lic.count=1;
lic.runLevel=StrToInt(it->SubItems->Strings[0]);
lic.devLevel=StrToInt(it->SubItems->Strings[1]);
strncpy(lic.comment,it->SubItems->Strings[2].c_str(),sizeof lic.comment);
if(!insertLicense(remoteFile.c_str(),&lic)){
insertLicense(localFile.c_str(),&lic);
}
scanLocalLicenses();
scanRemoteLicenses();
#if 0
/* create autorun.inf */
AnsiString autoRun=Form3->lst->Text+"autorun.inf";
if(!file_exists(autoRun.c_str())){
AnsiString s;
s=ExtractFileName(Application->ExeName);
WritePrivateProfileString("autoRun","open",(s+" -autorun").c_str(),autoRun.c_str());
CopyFile(Application->ExeName.c_str(),(Form3->lst->Text+s).c_str(),TRUE);
}
#endif
}
示例13: TIniFile
void TSettings::SaveToFile() {
TSettings *Settings = TSettings::Instance();
TIniFile *ini = new TIniFile(".\\settings.cfg");
ini->WriteBool("Global", "FullScreen", Settings->Fullscreen);
ini->WriteInteger("Global", "Width", Settings->FormsWidth);
ini->WriteInteger("Global", "Height", Settings->FormsHeight);
ini->WriteInteger("Global", "Left", Settings->FormsLeft);
ini->WriteInteger("Global", "Top", Settings->FormsTop);
ini->WriteBool("Global", "Sound", Settings->SoundEnabled);
ini->WriteInteger("Global", "SoundVolume", Settings->SoundVolume);
ini->WriteBool("Global", "Music", Settings->MusicEnabled);
ini->WriteInteger("Global", "MusicVolume", Settings->MusicVolume);
ini->WriteBool("Global", "HostMode", Settings->HostMode);
ini->WriteString("Global", "LastBase", Settings->LastBase);
for (int i = 1; i <= 5; i++) {
ini->WriteString("Players", "Player" + IntToStr(i), Settings->PlayerNames[i - 1]);
ini->WriteInteger("Players", "PlayerType" + IntToStr(i), (int) Settings->PlayerType[i - 1]);
}
int i = 0;
for (std::map <String, String> ::iterator it = BaseFiles.begin(); it != BaseFiles.end(); ++it) {
ini->WriteString("Bases", "basename" + IntToStr(i), it->first);
ini->WriteString("Bases", "base" + IntToStr(i), ExtractFileName(it->second));
++i;
}
ini->Free();
}
示例14: TForm
//---------------------------------------------------------------------------
__fastcall THttpTestForm::THttpTestForm(TComponent* Owner)
: TForm(Owner)
{
FIniFileName = LowerCase(ExtractFileName(Application->ExeName));
FIniFileName.SetLength(FIniFileName.Length() - 3);
FIniFileName = FIniFileName + "ini";
}
示例15: GetTempPath
//---------------------------------------------------------------------------
void __fastcall TForm1::AbZipOutline1DblClick(TObject *Sender)
{
bool Restoring;
String TempDir, SaveDir;
char TempPath[256];
String TempName;
GetTempPath(sizeof(TempPath), TempPath);
SaveDir = TempPath;
if (SaveDir[SaveDir.Length()] == '\\')
SaveDir.Delete(SaveDir.Length(), 1);
if (AbZipOutline1->SelectedZipItem) {
TempDir = AbZipOutline1->BaseDirectory;
Restoring = AbZipOutline1->ExtractOptions.Contains(eoRestorePath);
AbZipOutline1->ExtractOptions =
AbZipOutline1->ExtractOptions >> eoRestorePath;
AbZipOutline1->BaseDirectory = SaveDir;
try {
AbZipOutline1->ExtractFiles(AbZipOutline1->SelectedZipItem->FileName);
TempName = AbZipOutline1->SelectedZipItem->FileName;
AbUnfixName(TempName);
ShellExecute(Application->MainForm->Handle, NULL,
ExtractFileName(TempName).c_str(),
"", SaveDir.c_str(), SW_SHOWNORMAL);
}
catch (...) {
AbZipOutline1->BaseDirectory = TempDir;
}
AbZipOutline1->BaseDirectory = TempDir;
if (Restoring)
AbZipOutline1->ExtractOptions = AbZipOutline1->ExtractOptions << eoRestorePath;
}