Re: Tiburón and FastCode



Rudy Velthuis [TeamB] wrote:

Dennis wrote:

Hi

Perhaps because in the ol'days "string" was all there was?

OK

I am still shuddering at the thought of modifying all the apps I
have coded with plain ol' string. <sigh>

I am not sure it will to hard. CodeGear has probably done a lot of
work to make the transition to Unicode easy.

What if you simply make a search and replace on string -> AnsiString
- will everything just work as before?

Yes, and no. Also Char, PChar etc. must be replaced.

Oh, and if you cast a string to PAnsiChar instead of PChar, you might
be casting a UnicodeString to AnsiChar, which is hardly what you want:

ShellExecuteA(0, PAnsiChar('myfile.txt'), ...);

Since myfile.txt is probably a string, that might cause problems. So
you should do:

ShellExecute(0, PChar('myfile.txt'), ...);

or:

ShellExecuteA(0, PAnsiChar(AnsiString('myfile.txt')), ...);

Note that I used the -A version of ShellExecute for the PAnsiChar cast.
<g>

--
Rudy Velthuis [TeamB] http://www.teamb.com

"Some cause happiness wherever they go; others, whenever they go."
-- Oscar Wilde (1854-1900)
.



Relevant Pages

  • Re: Dll help with string parameters
    ... procedure FormShow(Sender: TObject); ... {Private declarations} ... PChar read FInfo1 write FInfo1; ... Declare Info1 and Info2 as string. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: C Header Conversion Problems
    ... It is never necessary to cast string literals to PChar. ... let's see the declaration of TKVListFree. ... I think the call to TKVListFree should be sufficient. ...
    (comp.lang.pascal.delphi.misc)
  • Re: StrPas question
    ... > I kind of baffled why the StrPas function is so simple. ... > the program can then do with the source string whatever it wants after that. ... That's what already happens when you assign a PChar to a string. ... calling SetString, then you can just as well do the assignment directly. ...
    (alt.comp.lang.borland-delphi)
  • Re: Pchar(x) Zuweisung
    ... function Test(n: Integer): PChar; ... für den String herausrückt. ... Das richtige Ergebnis könntest Du bekommen, wenn Du den ersten PChar gleich verarbeitest, bevor der Speicher vom zweiten Aufruf überschrieben wird. ...
    (de.comp.lang.delphi.misc)
  • Re: DDE Call back and its parameters and values
    ... Are you sure you cannot use a simple string for DataStr ... Procedure Test(Const P:PChar); ... Res:= DataStr StrPas is obsolete ...
    (comp.lang.pascal.delphi.misc)