Copie du wikimiroir

Ceci est un miroir du wiki de pascal.chat. La modification, l’historique et la connexion se trouvent là-bas.

PChar/fr

Deutsch · English · Español · Français · Русский

Le type de donnée PChar n'a pas de limitation de taille et désigne une chaîne de caractère terminée par 0 (compatible avec les chaînes du lanagage C).
But : Le type de données PChar est utilisé, par exemple, pour l'échange de données avec des DLL.
Exemple :

pascal
Var 
  s: String;
begin
  s := 'Test';
  Application.MessageBox(PChar(s)),'Titre',MB_OK);
end;

Définition d'un champ de donnée de type PChar :

pascal
 Var 
   p: PChar;

Exemple d'affectation de valeur correcte :

pascal
   p := 'Dies ist ein Null-terminierter String.';
   p := IntToStr(45);

Exemple d'affectation de valeur incorrecte :

pascal
   p := 45;

Dans l'exemple ci-dessus, la valeur à affecter n'a pas été convertie en PChar(cast).\


From the Free Pascal wiki, page "PChar/fr", as it stood on 2021-09-03 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Version 2, dernière modification par WikiArchive .