pablocasta
asked on
Convert String to PChar and viceversa
Some API routines need PChar type info and that's driving me mad, as I don't know how to convert string to PChar.
Example
var
Directory: string;
begin
Directory := Edit1.Text + '\*.*';
FindFirstFile(Directory,fc
{don't know if this parameter is rigth, but it's not the point}.
end;
An error occurs because Directory must be PChar. How could I solve this problem?
I've looked up in Delphi help for 'string to PChar conversions' and there's actually a help file about that, but it doesn't help much. It only explains what a PChar is and what it's functionality, but it doesn't mention anything about 'string to PChar conversions' as it's title says.
:( I'm sorry to say that Delphi4 help is not as good as I expected, but that's life...
My last question has to do with standards.. I mean, why do API's need PChar types and not string or integer types. I know they are null terminated strings, and I believe they are pointers, but that doesn't help me much.
There must be some interesting reason, and I would like to know why.
Thanks. Sorry for the points.
:)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER