comp.lang.ada
 help / color / mirror / Atom feed
From: nasser@apldbio.com (Nasser Abbasi)
To: seibert@monkfish.nosc.mil (Jerome D. Seibert)
Subject: Re: C File Descriptors in Ada95
Date: 1996/07/21
Date: 1996-07-21T00:00:00+00:00	[thread overview]
Message-ID: <nhwwzy3ygo.fsf@paralysys> (raw)
In-Reply-To: 1996Jul19.225520.22396@nosc.mil



   From: seibert@monkfish.nosc.mil (Jerome D. Seibert)

   I have a need to make a call to a C function from an Ada-95 procedure, and
   pass an open file descriptor to the C function.

   I have tried extending Ada.Text_IO and passing File.Stream to my C routine
   and then dereferencing the pointer in the C code (this did not work).
   I then tried performing an unchecked conversion from System.Address to
   Integer'Access to convert File.Stream to an Integer access, dereference the
   access pointer and passing this to my C routine as a file descriptor (int)
   (this did not work either).

   Any info on how I might do this would be greatly appreciated.

   ...snip..


You might want'a look at at fattach() :


NAME
     fattach - attach  a  STREAMS-based  file  descriptor  to  an
     object in the file system name space

SYNOPSIS
     int fattach(int fildes, const char *path);

MT-LEVEL
     MT-Safe

DESCRIPTION
     The fattach() routine attaches a STREAMS-based file descrip-
     tor  to an object in the file system name space, effectively
     associating a name with fildes.  fildes must be a valid open
     file descriptor representing a STREAMS file.  path is a path
     name of an existing object and the user must have  appropri-
     ate  privileges  or  be the owner of the file and have write
     permissions.  All subsequent operations on path will operate
     on  the STREAMS file until the STREAMS file is detached from
     the node.  fildes can be attached to  more  than  one  path,
     that is, a stream can have several names associated with it.


bye,
Nasser



-- 
Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server application 
for Nucleic acid and protein sequence search and analysis. 
Perkin Elmer - Applied BioSystem division. email:  nasser@apldbio.com   
MSEE(control), MSCS, MSCE, FM (Fide Chess Master).







  reply	other threads:[~1996-07-21  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-19  0:00 C File Descriptors in Ada95 Jerome D. Seibert
1996-07-21  0:00 ` Nasser Abbasi [this message]
1996-07-22  0:00 ` j. doe
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox