开发者

Should I call Source.Seek(0,soFromBeginning) after TFileStream.Create?

I have seen in quite few places (one example here: http://pascalgamedevelopment.com/archive/index.php/t-1204.html) people doing this.

Embarcadero documentation says nothing about the position of the header in the file/stream after creating the stream.


Conclusion:

Since the documentation does not guaranty the position of the cursor, we should use 'Seek=0'. Even if now the cursor is placed at the begi开发者_高级运维nning of the file, we will never know how this will change in time. Since Embarcadero does not document this, it looks like they reserve the right to change it.


TFileStream.Create just opens file handle and leaves file position where the Win32 put it after the handle was open - at the beginning on the file.

There's no need to Seek to 0 position; you are already there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜