[lazarus] Why is this not working? (PChar conversion)

Michael Van Canneyt michael.vancanneyt at wisa.be
Fri Sep 26 04:34:12 EDT 2003




On Fri, 26 Sep 2003, Shin The Gin wrote:

> Am Freitag, 26. September 2003 09:14 schrieb Tony:
> > Given this:
> >
> >   FComments: String;
> >   p : PChar;
> >
> > This line compiles fine:
> >
> >   p := PChar(ExtractFilename(FFileSource));
> >
> > But this line generates an illegal type conversion:
> >
> >   p := PChar(FComments);
> >
> > Any ideas?
>
> Has FComments been initialized? Just having a declaration doesn't give you a
> true string, does it?

It does for ansistrings.
An ansistring is guaranteed to be initially empty.

Michael.






More information about the Lazarus mailing list