全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1348
推到 Plurk!
推到 Facebook!

檔案的問題

尚未結案
kraen4468
初階會員


發表:66
回覆:112
積分:35
註冊:2003-12-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-18 15:56:14 IP:61.222.xxx.xxx 未訂閱
我想寫一個開啟檔案下面是找到的API可是我不知道怎麼用它呢
HANDLE CreateFile(        LPCTSTR lpFileName,        
    DWORD dwDesiredAccess,        
    DWORD dwShareMode,        
    LPSECURITY_ATTRIBUTES lpSecurityAttributes,        
    DWORD dwCreationDistribution,        
    DWORD dwFlagsAndAttributes,        
    HANDLE hTemplateFile         
copy);
~我還在學習狀態希望多多向您學習~
kraen4468
初階會員


發表:66
回覆:112
積分:35
註冊:2003-12-04

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-18 16:26:02 IP:61.222.xxx.xxx 未訂閱
還有這個用法翻譯了還是看不太懂
CopyAFile(
LPSTR szFullPathSrc, 
LPSTR szFullPathDst, 
INT cmo, 
INT fAppend
);
~我還在學習狀態希望多多向您學習~
erosme
初階會員


發表:5
回覆:44
積分:29
註冊:2002-12-23

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-02-21 01:47:18 IP:218.166.xxx.xxx 未訂閱
Dear Kraen4468, 你何不用下列簡單方法. #include 〈stdio.h〉 FILE *file1; char x; file1 = fopen("FileName","r"); while(!feof(file1)) { fread(&x,1,1,file1); ...... } fclose(file1); 發表人 - erosme 於 2004/02/21 02:50:27
kraen4468
初階會員


發表:66
回覆:112
積分:35
註冊:2003-12-04

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-02-25 17:47:26 IP:61.222.xxx.xxx 未訂閱
不過我還是解不過CreateFile的用法 ~我還在學習狀態希望多多向您學習~
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-02-26 13:14:13 IP:61.218.xxx.xxx 未訂閱
引言: 不過我還是解不過CreateFile的用法 ~我還在學習狀態希望多多向您學習~
kraen4468您好: 希望下面方法能幫的上忙 <>> < class="code"> HANDLE hFile; DWORD dwBytesWritten,dwPos; AnsiString string; hFile = CreateFile("testfile.txt", // LPCTSTR lpFileName GENERIC_WRITE, // DWORD dwDesiredAccess 0, // DWORD dwShareMode NULL, // LPSECURITY_ATTRIBUTES lpSecurityAttributes CREATE_ALWAYS, // DWORD dwCreationDistribution FILE_ATTRIBUTE_NORMAL, // DWORD dwFlagsAndAttributes NULL); // HANDLE hTemplateFile copy if(hFile == INVALID_HANdlE_VALUE) { ErrorProcessor(); return; } LockFile(hFile,0,0,GetFileSize(hFile,NULL),0); string = "This is context."; WriteFile(hFile, string.c_str(), string.Length(), &dwBytesWritten, NULL); UnlockFile(hFile,0,0,GetFileSize(hFile,NULL),0); CloseHandle(hFile); CopyFile and CopyFileEx The CopyFile function copies a file from one location to another. The basic syntax is as follows: CopyFile("src.fil", "dest.fil", true); You can copy files to the same drive, to another drive, or even to another machine on a network. The third parameter indicates what Windows should do if the file already exists in the target location. When this parameter is true, then Windows doesn't overwrite the existing file; it reports an error instead. When this parameter is false, then Windows will overwrite the existing file. You can attain more control over copy operations by using CopyFileEx rather than CopyFile. Among other things, CopyFileEx allows you to use a callback function that's called periodically during the copy operation. You could use this callback function to display the progress of the copy operation. Unfortunately, CopyFileEx is available only in the Windows NT API.
/*生活是一種藝術,用心生活才能享受生活*/
系統時間:2024-05-05 9:15:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!