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

請問個用法TMemoryStream->Seek

答題得分者是:RaynorPao
jumpsister
一般會員


發表:5
回覆:3
積分:1
註冊:2004-06-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-07-12 12:17:09 IP:203.67.xxx.xxx 未訂閱
小弟這幾天在看檔案的I/O;    爬文發現TMS之好用..... TMS->Seek(int Offset, Word Origin);.....    BCB help上面寫int<0代表從我load的資料後面開讀取資料(是這樣嗎) 那後面是什麼意思 Word Origin? 那如果我想從資料後面只讀取一小部分..那應該怎麼使用這用法 感謝各位大大之指教......
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-07-12 13:59:45 IP:203.73.xxx.xxx 未訂閱
引言: 小弟這幾天在看檔案的I/O; 爬文發現TMS之好用..... TMS->Seek(int Offset, Word Origin);..... BCB help上面寫int<0代表從我load的資料後面開讀取資料(是這樣嗎) 那後面是什麼意思 Word Origin? 那如果我想從資料後面只讀取一小部分..那應該怎麼使用這用法 感謝各位大大之指教......
jumpsister 你好:
(1)有關這一點,在 BCB Help 裡面都說得非常清楚,建議你仔細看看
TCustomMemoryStream::Seek
Moves the current position of the stream by Offset bytes, relative to 
the origin specified by Origin.    virtual int __fastcall Seek(int Offset, Word Origin);    Description
Use Seek to move the current position within the memory stream by the 
indicated offset. Seek allows an application to read from or write to 
a particular location within the Memory associated with the memory 
stream.    If Offset is a negative number, the seek is backward from the 
specified origin. The following table shows the different values of 
Origin and their meanings for seeking.    Value                 Meaning
----------------------------------------------------------------------
soFromBeginning   Offset is from the beginning of Memory. Seek moves to the position Offset. Offset must be >= 0.
soFromCurrent     Offset is from the current position. Seek moves to Position + Offset.
soFromEnd         Offset is from the end of Memory. Offset must be <= 0 to indicate a number of bytes before the end of the memory buffer.    Seek returns the new value of the Position property.    Note:
Seek does no error checking on the value provided for Offset. Do not 
call seek with an offset that would move the current position less 
than 0 (before the start of Memory) or greater than Size (beyond the 
end of the memory buffer).
(2)請參考以下的範例程式碼 (讀取檔案最後 5 個 byte 為例)
   >>>>>>>>>>> >
    < src="http://delphi.ktop.com.tw/loadfile.php?TOPICID=10003806&CC=223734"> -- Enjoy Researching & Developing --    發表人 - RaynorPao 於 2004/07/12  14:04:10
        
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
jumpsister
一般會員


發表:5
回覆:3
積分:1
註冊:2004-06-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-07-12 14:45:28 IP:203.67.xxx.xxx 未訂閱
感謝版主大人 小弟應該再看仔細一點的..(搞錯方向) 也謝謝版主題舉簡單的例子讓小弟了解..
系統時間:2024-06-29 21:31:44
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!