PChar/fr: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: PChar/fr
| Old | New | Line | |
|---|---|---|---|
| 1 | + | \ | |
| 2 | + | Le [[Data type/fr|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).\ | |
| 3 | + | But : Le type de données **PChar** est utilisé, par exemple, pour l'échange de données avec des DLL.\ | |
| 4 | + | Exemple : | |
| 5 | + | ||
| 6 | + | ``` pascal | |
| 7 | + | Var | |
| 8 | + | s: String; | |
| 9 | + | begin | |
| 10 | + | s := 'Test'; | |
| 11 | + | Application.MessageBox(PChar(s)),'Titre',MB_OK); | |
| 12 | + | end; | |
| 13 | + | ``` | |
| 14 | + | ||
| 15 | + | Définition d'un champ de donnée de type PChar : | |
| 16 | + | ||
| 17 | + | ``` pascal | |
| 18 | + | Var | |
| 19 | + | p: PChar; | |
| 20 | + | ``` | |
| 21 | + | ||
| 22 | + | Exemple d'affectation de valeur correcte : | |
| 23 | + | ||
| 24 | + | ``` pascal | |
| 25 | + | p := 'Dies ist ein Null-terminierter String.'; | |
| 26 | + | p := IntToStr(45); | |
| 27 | + | ``` | |
| 28 | + | ||
| 29 | + | Exemple d'affectation de valeur incorrecte : | |
| 30 | + | ||
| 31 | + | ``` pascal | |
| 32 | + | p := 45; | |
| 33 | + | ``` | |
| 34 | + | ||
| 35 | + | Dans l'exemple ci-dessus, la valeur à affecter n'a pas été convertie en PChar(cast).\ | |
| 36 | + | ||
| 37 | + | --- | |
| 38 | + | *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](/wiki-contact).* |
