[fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

Santiago A. svaa at ciberpiula.net
Thu Aug 26 11:20:41 CEST 2021


Hello:

Freepascal 3.2.0. Windows 7-32bits

TMyObject=class   private     fDset:TDataset;    function 
GetBookmark:TBookmarkStr; ... end;

function TMyObject.GetBookmark:TBookmarkStr; Begin   
result:=FDset.Bookmark; end;

I get this compiling error:
Incompatible types: got "TBytes" expected "AnsiString"

Nevertheless, /TbookmarkStr/ documentation example assigns bookmark 
property to a TBookmarkStr variable
https://www.freepascal.org/docs-html/fcl/db/tdataset.bookmark.html

I have considered to convert the TBytes to AnsiString, but instead to 
doing a research about AnsiString internals, or creating a function that 
copies bytes in a loop, I supposed that there was already a function to 
do that. I found BytesOf
https://www.freepascal.org/docs-html/rtl/sysutils/bytesof.html
The abstract is  "Return the bytes in a string", when in fact, according 
with the text below,  it does the opposite, returns the string in an 
array of bytes.

Is there any function that move the bytes to an AnsiString?

-- 
Saludos
Santiago A.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210826/415426b8/attachment.htm>


More information about the fpc-pascal mailing list