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

讀取循序檔的問題

答題得分者是:dllee
leeli
初階會員


發表:57
回覆:55
積分:27
註冊:2003-06-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-06-26 17:58:38 IP:210.80.xxx.xxx 未訂閱
各位大大: 小弟我使用 fscanf(fp,"%s",uSsd); Edit2->Text=uSsd; 為何遇到有*開頭的data他就無法顯示出來呢? 能否請各位解決一下小弟我的問題,感激不盡!
------
小弟我是BCB的新手,若有發問一些蠢問題,敬請見諒。
對於各位的大力協助,感激不盡!
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-06-26 18:28:48 IP:61.231.xxx.xxx 未訂閱
請問您的檔案內容是什麼呢? 如果是類似    1111 222 333 aaa bbb ccc    這樣一行一行的資料,直接使用 TStringList 會比較快    
TStringList *list=new TStringList;
list->LoadFromFile("資料檔.txt");
Edit2->Text=list->Strings[0]; // 取得第一行的內容
delete list;
也可以直接放一個 TListBox 來顯示全部: ListBox1->Items->LoadFormFile("資料檔.txt"); 即然都已升級到 BCB 了,就要善用 VCL 及 BCB 提供的函式,不必再用 fscanf/fprintf 之類的指令了 <>沒空更新的網頁... href="http://dllee.adsldns.org">http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
axsoft
版主


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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-06-26 18:39:24 IP:61.218.xxx.xxx 未訂閱
引言: 各位大大: 小弟我使用 fscanf(fp,"%s",uSsd); Edit2->Text=uSsd; 為何遇到有*開頭的data他就無法顯示出來呢? 能否請各位解決一下小弟我的問題,感激不盡!
Syntax
#include 
int fscanf(FILE *stream, const char *format[, address, ...]);    您的程式碼是否修正一下試試!
fscanf(fp,"%s",&uSsd);
Edit2->Text=uSsd;
可否把你的完整程式列出來?以ASCII表看來"*"為正常顯示的字元理應可以顯示才對. <!-- End Ascii Table ---> <!-- Begin ExtendedTable --->
width="355" height="23">
ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or '@' or an action of some sort. ASCII was developed a long time ago and now the non-printing characters are rarely used for their original purpose. Below is the ASCII character table and this includes descriptions of the first 32 non-printing characters. ASCII was actually designed for use with teletypes and so the descriptions are somewhat obscure. If someone says they want your CV however in ASCII format, all this means is they want 'plain' text with no formatting such as tabs, bold or underscoring - the raw format that any computer can understand. This is usually so they can easily import the file into their own applications without issues. Notepad.exe creates ASCII text, or in MS Word you can save a file as 'text only'
width="715" height="488">
Extended ASCII Codes As people gradually required computers to understand additional characters and non-printing characters the ASCII set became restrictive. As with most technology, it took a while to get a single standard for these extra characters and hence there are few varying 'extended' sets. The most popular is presented below.
width="573" height="335">
發表人 - axsoft 於 2003/06/27 00:35:09
系統時間:2024-05-03 15:25:19
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!