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