Re: SetString



On Wed, 28 Feb 2007 05:29:24 +0100, Hans-Peter Diettrich
<DrDiettrich1@xxxxxxx> wrote:

Is it really possible, that D7 offers no SetWideString procedure?

Must I really copy WideChar by WideChar, from an PWideChar into an
WideString?

D4 does automatic conversion it creates a new WideString up to the
position of the first #0#0

Var
pWC :PWideChar;
WS1, WS2 :WideString;
S :String;
begin
// Get some data in memory
WS1 := 'Test Data'#0' More';
// Point a PWideChar at it
pWC := Addr( WS1[1] );
// Automatic conversion to a new WideString
// It will only get data up to #0#0
WS2 := pWC;
// Automatic conversion to Ansi String
S := WS2;
//
ShowMessage( S + ' ' + IntToStr(Length(S)) );
end;


.



Relevant Pages

  • Re: Are _T() and TEXT() macros equivalent?
    ... David Ching wrote: ... I would say that the vast majority of the uses of the automatic conversion from narrow to wide string are with hard coded strings where the programmer simply forgot to use _T. ... Soon the ANSI code page will be gone, and hybrid UTF16/UTF8 applications may become more common, and the automatic conversion will do the wrong thing. ...
    (microsoft.public.vc.mfc)
  • String^, const char*, std::string, and c_str( )
    ... Therefore adopting the ... Much of our managed code is concerned with interfacing to native C++ code ... In Managed C++ there was an automatic conversion between ... a std::string or a String^. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: getting a form field to default to the value entered in the last record
    ... >concatenating the double quotation marks before and after Me.textbox? ... The DefaultValue property is a string. ... makes the right guess in its automatic conversion process. ...
    (microsoft.public.access.forms)
  • Re: getting a form field to default to the value entered in the last record
    ... >concatenating the double quotation marks before and after Me.textbox? ... The DefaultValue property is a string. ... makes the right guess in its automatic conversion process. ...
    (microsoft.public.access.formscoding)