導航:首頁 > 文件教程 > delphi新建文件夾

delphi新建文件夾

發布時間:2021-12-03 01:29:34

1. delphi 如何在指定目錄下創建文件

the method is so more. such as following,
var
list : TStringlist;
begin
list := TStringlist.Create;
list.DelimitedText := '1900-11-16';
list.SaveToFile('F:\test.txt'); //create text file in disk F:
list.Free;
end;

2. 如何用DELPHI創建一個文件夾和一個文本文件

創建文件:
CreateFile(FileName, fmCreate,)
創建文件夾:
ForceDirectiory
幫助裡面有這兩個函數的詳細說明。

3. delphi 怎麼新建文件

同意樓上的,有點筆誤
myinifile.redainteger('小節名','關鍵字','預設值');//讀取整數型數據。
應為
myinifile.readinteger('小節名','關鍵字','預設值');//讀取整數型數據

創建一個文件的函數:
function FileCreate(const FileName: string): Integer;

Description
FileCreate creates a new file with the specified name. If the return value is positive, the function was successful and the value is the file handle of the new file. A return value of -1 indicates that an error occurred.

4. delphi的文件操作,比如創建一個文件是怎樣操作的(只創建一個空文件)

var
filename:string;
FHandle:integer;
begin
filename:='e:\database.txt';
if(not fileexists(filename))then
begin
FHandle:=filecreate(filename);
end;

5. Delphi 7創建文件夾的問題

DateToStr()返回的字元串格式跟系統的日期分隔符有關,只有當系統的日期分隔符是「-」和「.」時,用返回回的字元串通過答ForceDirectories()創建文件夾才會成功。系統的日期分隔符是「/」時是不行的。 在XP下也一樣。系統的日期分隔符在用資源管理器瀏覽文件的「詳細信息」視圖下就看得出來。

6. 怎麼用delphi建立一個文件夾

給你個函數吧
/*******************************************************************************
* 建立文件夾路徑函數 *
*******************************************************************************/
int SearchStr(CString Source,char SearChar,int Howth) //搜索匹配的字元位置
{
int HowBit;
HowBit = Howth;
int len = strlen(Source);
for (int i = HowBit;i <len;i++)
{
if (Source[i] == SearChar)
{
return i;
break;
}
}
return -1 ;
}
/*******************************************************************************
* 建立文件夾 *
*******************************************************************************/
void CreatePath(CString Path)
{
int SearSult = SearchStr(Path, ': ',1);
CString a;
CString Pathstr;
int len = strlen(Path);

while(SearSult != -1)
{
SearSult = SearchStr(Path, '\\ ',SearSult+3);
if(SearSult!=-1)
{
Pathstr = Path.Left(SearSult);
if(_access(Pathstr,0)!=0)
CreateDirectory(Pathstr,0);
}
else
break;
}
if(Path[len-1]!= '\\ ')
{
if(_access(Path,0)!=0)
CreateDirectory(Path,0);
}
}

7. delphi中CreateDirectory和CreateDir有什麼區別創建文件夾的同時能定義文件夾的屬性嗎

CreateDir也是通過調用CreateDirectory實現的,只是簡化了參數,並且增加了linux支持。
CreateDirectory只能用於回windows編程。CreateDir在linux下Kylix也能調用,答使代碼的兼容性、可移植性更強。

在SysUtils單元中:
function CreateDir(const Dir: string): Boolean;
begin
{$IFDEF MSWINDOWS}
Result := CreateDirectory(PChar(Dir), nil);
{$ENDIF}
{$IFDEF LINUX}
Result := __mkdir(PChar(Dir), mode_t(-1)) = 0;
{$ENDIF}
end;

8. 我想在DELPHI 中在本機PROGRAM FILES 文件夾下建立一個目錄123

var
adr:array[0..MAX_PATH] of Char;
begin
GetSystemDirectory(adr,MAX_PATH);

end;

adr裡面就是你想要的路徑,然後在去創建目錄去。

9. delphi怎麼創建以當前日期命名的文件夾

CreateDirectory( PChar( 'C:\' + FormatDateTime( 'yyyymmdd', Now ) );

10. delphi 如何創建文件夾

forcedirectories和CreateDirectory都能創建文件 ForceDirectories可以創建多層目錄. 如果你創建一個目錄為c:\mymusic\music 如果你的C盤不存在一個叫mymusic的文件夾 的話程序會自動創建,函數執行的結果是, 創建了兩個文件夾,mymusic和music,music為 mymusic的子文件夾. CreateDirectory只能創建一個文件夾,如果 mymusic不存在,則反回創建music文件夾失敗! procere TMain.WriteVPTXT(str:string);varMytextFile : TextFile; tempstr : string; SysTime: TsystemTime;begintryGetLocalTime(SysTime); //AssignFile(MyTextFile,'D:\delphi\delphitest\time.ini'); if not DirectoryExists('D:\Test') then CreateDirectory('D:\Test',nil); //創建單個目錄 // forcedirectories ('D:\Test'); //創建多層目錄 tempstr:='D:\Test\'+inttostr(Systime.wYear)+inttostr(systime.wMonth)+inttostr(systime.wDay)+'.txt'; AssignFile(MyTextFile,tempstr); if not fileExists(tempstr) then ReWrite(MyTextFile) else Append(MyTextFile);

閱讀全文

與delphi新建文件夾相關的資料

熱點內容
網站參數篩選怎麼做 瀏覽:627
幼兒編程有什麼問題 瀏覽:693
工商銀行app人工服務在哪裡 瀏覽:19
怎麼讓文件中全體內容往下移 瀏覽:783
魔獸爭霸126版本轉換器 瀏覽:984
word2003精簡版下載 瀏覽:703
微博跳轉appstore 瀏覽:537
打開文件時許可權a代表什麼 瀏覽:155
昆侖通態導出數據文件名 瀏覽:338
手機遷移數據為什麼需要重新登錄 瀏覽:958
錄入資料庫的圖片如何更改 瀏覽:132
怎樣獲取郵箱帳號和密碼 瀏覽:809
怎麼通過js實現回到指定頁面 瀏覽:140
如何用網路簽字 瀏覽:552
三星電視拆機教程 瀏覽:19
創維怎麼連接網路 瀏覽:868
2007版word繪圖在哪裡 瀏覽:311
可以拍車牌的app是什麼 瀏覽:508
文件加個井字型大小什麼意思 瀏覽:155
怎麼刪除多重網路 瀏覽:999

友情鏈接