Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!bloom-beacon!eru!luth!sunic!mcsun!hp4nl!hpuamsa!ton From: ton@hpuamsa.UUCP (Ton 't Lam AEO) Newsgroups: comp.lang.pascal Subject: Re: Unix system call `open' from HP-Pascal; how? Message-ID: <7900001@hpuamsa.UUCP> Date: 5 Jul 90 08:44:34 GMT References: <1158@gufalet.let.rug.nl> Organization: HP The Netherlands (Aka Holland) Lines: 55 Hallo, I have piece of code and I remember to have it working. (But it may have been beginner's luck ?!) TYPE PATHNAME = PACKED ARRAY [1..50] OF CHAR; ... FUNCTION open VAR path : PATHNAME; oflag: INTEGER); INTEGER: EXTERNAL; ... BEGIN path = '/dev/hpib9'; path[11] = CHR(0); { The C-open expects that a string is terminated with character zero! } eid = open( path, 2); { 2 = O_RDWR; look also in /usr/include/stdio.h } Another possible solution that will works: FUNCTION $ ALIAS 'open' $ dopen VAR path : PATHNAME; oflag: INTEGER); INTEGER: EXTERNAL; and dopen() is in a so called onionskin, this is a little C-program: dopen( path, oflag) char *path; int oflag; { int eid; if( (eid = open( path, oflag)) == -1) { perror( "Problem "); exit( 1); } return( eid); } Compile the C program as follows: cc -c cprog.c The result is an object file called cprog.o Now do: pc -o pprog pprog.p cprog.o Good luck, Ton 't Lam,