Bonjour à tous,
Voici un bout de code qui provient de l'aide de Delphi 7 sur la fonction FileRead :
Je n'arrive pas à piger ce que fait exactement cette ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 var iFileHandle:Integer; iFileLength:Integer; iBytesRead:Integer; Buffer:PChar; begin iFileHandle :=FileOpen(OpenDialog1.FileName,fmOpenRead); iFileLength :=FileSeek(iFileHandle,0,2); FileSeek(iFileHandle,0,0); Buffer :=PChar(AllocMem(iFileLength +1)); iBytesRead :=FileRead(iFileHandle,Buffer^,iFileLength); ...
Normalement "AllocMem(iFileLength +1)" doit renvoyer un Pointer et un "PChar(Pointer)" je pige pas ce que ça fait.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Buffer :=PChar(AllocMem(iFileLength +1));
Quelqu'un peut m'aider ?
Merci,
Bobby-B
Partager