FileStream.Read(buffer[1], BufferSize);
Thank you for your attention
H.Ahmadi
> consider that i have a big String . if length of the String is more than 64k
> then we can not be sure that the String have neighbouring cells in memory.
Yes we can, a Delphi string is allocated as one continuous (virtual)
memory block, and
> FileStream.Read(buffer[1], BufferSize);
will work if BufferSize >= Length(buffer);
Danny
---
> consider that i have a big String . if length of the String is
> more than 64k then we can not be sure that the String
> have neighbouring cells in memory.
Yes, you can. The entire string value is guaranteed to always be stored in
a single contigious memory block.
> in this case how can i read a String from FileStream?
Exactly as you would expect to - by specifying the memory offset of the
first desired character position, and the number of characters to read. Try
it and you will see that it does work fine.
> im not sure that following command work well.
Yes, it will.
Gambit
> Hi,
> consider that i have a big String . if length of the String is more
> than 64k then we can not be sure that the String have neighbouring
> cells in memory. i mean that var s:string; ....
> address(s[n])=address(s[n+1])-1 /// false
You seem to be thinking of segmentation. This is not a problem under
Win32 anymore. You can be sure that all characters are addressable in
one big memory block.
--
Rudy Velthuis [TeamB] http://rvelthuis.de
"His ignorance is encyclopedic"
-- Abba Eban (1915-2002)
> will work if BufferSize >= Length(buffer);
I think you meant '<=' instead of '>='.
Gambit
>> will work if BufferSize >= Length(buffer);
>
> I think you meant '<=' instead of '>='.
I hope so!
Danny
---