oder nachträglich die #0 abschneiden
Delphi-Quellcode:
Function AppDataPath: String;
Var
S: String;
Begin
SetLength(S, ExpandEnvironmentStrings('%APPDATA%', nil, 0));
If Length(S) > 0 Then
ExpandEnvironmentStrings('%APPDATA%', PChar(S), Length(S));
Result := PChar(S);
End;