|
|
导航: |
论坛 -> DELPHI技术
斑竹:liumazi,sephil |
|
作者: |
jjbb (jjbb) |
★☆☆☆☆ |
-
|
普通会员 |
|
2003/7/14 12:36:01 |
标题: |
怎么把一个结构存为一个txt文件? |
浏览:2325 |
|
加入我的收藏 |
楼主: |
怎么把一个结构存为一个txt文件?
----------------------------------------------
- |
作者: |
zizii (高高高级馒头) |
★☆☆☆☆ |
-
|
神秘会员 |
|
2003/7/14 15:08:03 |
1楼: |
定义一个结构,例如: type txInfo=record Date:Tdate; Time:Ttime; Event:string[100]; end; 定义变量: var RecordFile:file of txInfo; RecordData:txInfo; 添加记录: recordData.Event :=Memo_event.text; recordData.Time :=StrToTime(ME_time.text); recordData.Date :=StrToDate(ME_date.text); write(recordFile,recordData); 根据currec读上一条记录: if currec-1<0 then begin currec:=0; seek(recordFile,currec); showmessage('到头了拉!'); end else begin currec:=currec-1; seek(recordFile,currec); read(recordFile,recordData); seek(recordFile,currec); ME_date.Text :=DateToStr(recordData.date); ME_time.Text :=TimeToStr(recordData.time); Memo_event.Text :=recordData.Event ; end; 读下一条原理一样,把currec:=currec-1改为currec:=currec+1
----------------------------------------------
维护世界和平,共创美好盒子。
|
|