Convert string to PAnsiChar in Delphi 2009

后端 未结 6 609
灰色年华
灰色年华 2021-02-01 17:50

I\'m converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString.

Here\'s an example to de

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 18:36

    Instead of using type String, use RawByteString:

    s: RawByteString;
    
    s := LoadSomeRegularString(usually a string type);
    
    PAnsiChar(s) <<< all fine.
    

提交回复
热议问题