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: <7900002@hpuamsa.UUCP> Date: 5 Jul 90 10:02:19 GMT References: <1158@gufalet.let.rug.nl> Organization: HP The Netherlands (Aka Holland) Lines: 74 I made a little typo. I said: FUNCTION open ( VAR path : PATHNAME; oflag: INTEGER); INTEGER: EXTERNAL; This must be: FUNCTION open ( VAR path : PATHNAME; oflag: INTEGER): <--- INTEGER; <--- EXTERNAL; I exchanged the : and ; By the way thinking it over you don't need an unionskin. $sysprog on$ $underscore on$ program tryit( input, output); const O_RDWR = 2; O_WRONLY = 1; type pathname = packed array[1..81] of char; cstring = packed array[1..81] of char; var eid : integer; err ['_errno'] : integer; path : pathname; str : cstring; len : integer; function $ ALIAS 'open' $ dopen (var path : pathname; oflag : integer) : integer ; external; function $ ALIAS 'close' $ dclose ( fd : integer) : integer ; external; function $ ALIAS 'write' $ send ( fd : integer; var buffer: cstring; nbyte : integer) ; external; begin path = 'filename'; path[9] = chr(0); eid = dopen( path, O_RDWR); if eid = -1 then begin writeln( 'Err: ', err'); halt; end; cstring = 'Just a sentence' + chr( 0); len = strlen( cstring); write( eid, cstring, len); { something like this } dclose( eid); end. This will do. You may want to look in the UNIX reference manual at create(2), open(2), read(2), close(2). Please give a little reply, if it went fine. Regards, Ton 't Lam.