特殊的檔案格式 |
尚未結案
|
benson5033
一般會員 發表:44 回覆:47 積分:18 註冊:2004-08-16 發送簡訊給我 |
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
你應該採用 binary mode 來開檔案: FILE *fp = fopen("test.dat", "rb"); 以下擷取 BCB HELP 關於 fopen 的說明: Prototype FILE *fopen(const char *filename, const char *mode); FILE *_wfopen(const wchar_t *filename, const wchar_t *mode); Description Opens a stream. fopen opens the file named by filename and associates a stream with it. fopen returns a pointer to be used to identify the stream in subsequent operations. The mode string used in calls to fopen is one of the following values: Value Description r Open for reading only.
w Create for writing. If a file by that name already exists, it will be overwritten.
a Append; open for writing at end-of-file or create for writing if the file does not exist.
r Open an existing file for update (reading and writing).
w Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten.
a Open for append; open (or create if the file does not exist) for update at the end of the file. To specify that a given file is being opened or created in text mode append a t to the mode string (rt w t and so on). Similarly to specify binary mode append a b to the mode string (wb a b and so on). fopen also allows the t or b to be inserted between the letter and the character in the mode string; for example rt is equivalent to r t.
|
benson5033
一般會員 發表:44 回覆:47 積分:18 註冊:2004-08-16 發送簡訊給我 |
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
|
brook
資深會員 發表:57 回覆:323 積分:371 註冊:2002-07-12 發送簡訊給我 |
引言: 有一檔案很奇怪,用記事本打開時看到的是一堆亂碼,用fgets,fread讀也讀不出來,不知該怎麼辦??? 只知道用vb讀時,要用Open file For Random As #3 Len=4,問題就在這Random 查了一下bcb help,找不到有關Random的文件,不知那位大大知道,能指點一下嗎??1.Random是隨機檔,dos版的basic,c 的書大都會提到,但寫法是因人而異,沒有原版的程式,就比較難知道它的計算方法. 2.你知道用vb讀時,要用Open file For Random As #3 Len=4,我想你一定有原始程式,何不post上來看看,假如不方便,片斷程式也可. |
benson5033
一般會員 發表:44 回覆:47 積分:18 註冊:2004-08-16 發送簡訊給我 |
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
|
benson5033
一般會員 發表:44 回覆:47 積分:18 註冊:2004-08-16 發送簡訊給我 |
我已經將檔案放至http://delphi.ktop.com.tw/topic.php?TOPIC_ID=60805,請幫我看看
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
|
brook
資深會員 發表:57 回覆:323 積分:371 註冊:2002-07-12 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |