Pchars are just a pain, I do not use any Pchars.. instead I use AnsiStrings 
that I can manipulate in a way that is easy and then I just do 
Pchar(myvariable) whenever I need to use a function that needs a Pchar… like 
this:
 
Var 
   MessageBoxText:Ansistring;
 
..
..
windows.messagebox(0,pchar(MessageBoxtext)…..bla bla bla);  
 
 
There is probably a better way but for me conversion to Pchar is a small price 
to pay for easy string manipulation.  AnsiStrings take care of their own memory 
allocation and the Pchar conversion doesn’t require an actual Pchar variable to 
bother with managing.
 
James
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to