Autor Beitrag
Der Jan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win2k prof, WinXP prof, Linux
D6 Prof, BCB4 Std, BCB6 Ent, BDS 2006 Ent
BeitragVerfasst: Do 22.12.05 10:38 
Hallo zusammen,

bin gerade dabei ein paar C-Header nach Pascal zu übersetzen, zwecks Nutzung einer C-Library unter Delphi.
Jetzt hab ich nur ein Problem: Gibt es in Pascal eine Entsprechung zum C-Datentyp FILE?

FILE ist ein struct (record) und in C folgendermaßen definiert:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
typedef struct
{
        unsigned char  *curp;       /* Current active pointer     */
        unsigned char  *buffer;     /* Data transfer buffer       */
        int             level;      /* fill/empty level of buffer */
        int             bsize;      /* Buffer size                */
        unsigned short  istemp;     /* Temporary file indicator   */
        unsigned short  flags;      /* File status flags          */
        wchar_t         hold;       /* Ungetc char if no buffer   */
        char            fd;         /* File descriptor            */
        unsigned char   token;      /* Used for validity checking */
}       FILE;                       /* This is the FILE object    */

_________________
Gruß, Jan
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 22.12.05 11:08 
Hallo,

eigentlich so :?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
type
  FILE = record
    curp  : PChar;       (* Current active pointer     *)
    buffer: PChar;       (* Data transfer buffer       *)
    level : Integer;     (* fill/empty level of buffer *)
    bsize : Integer;     (* Buffer size                *)
    istemp: Word;        (* Temporary file indicator   *)
    flags : Word;        (* File status flags          *)
    hold  : Word;        (* Ungetc char if no buffer   *)
    fd    : Char;        (* File descriptor            *)
    token : Byte;        (* Used for validity checking *)
    end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Der Jan Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 98

Win2k prof, WinXP prof, Linux
D6 Prof, BCB4 Std, BCB6 Ent, BDS 2006 Ent
BeitragVerfasst: Do 22.12.05 11:45 
:roll:

Ähm, nee. So schlau, die C-struct in nen Pascal-Record zu übersetzen, wäre ich schon selbst. Ich wollte wissem, ob es einen Pascal-Datentyp gibt, der kompatibel ist.
Wenn ein paar Funktionen der C-Library z.B. FILE* als Parameter nutzen, sollte man schon einen Pointer auf die richtige Struktur übergeben.
Die zugehörigen File-Funktionen (fopen, fclose etc) sind im C-Header stdio.h definiert und verweisen auf externe Definitionen in der RTL . Deshalb mein Gedanke, es könnte etwas passendes in Delphi geben....

_________________
Gruß, Jan