comp.lang.ada
 help / color / mirror / Atom feed
* Using C++ ifstream class in Ada95
@ 1998-02-19  0:00 Justin Braach
  0 siblings, 0 replies; only message in thread
From: Justin Braach @ 1998-02-19  0:00 UTC (permalink / raw)



Is there a way to convert a C++ ifstream class object into an Ada
File_Type object?
For Example:

C++ code: --

#include <fstream.h>
extern "C" void ada_proc( ifstream * );  // This is how it's got to be,
(predefined).

int main(int argc, char *argv[])
{
   ifstream *infile;

   infile = new ifstream();
   infile->open(argv[1], ios::nocreate);
   if( infile )
   {
      ada_proc( infile );
   ...
}

Ada Code: -- In a package

procedure ada_proc( infile : file_type ) is  -- File_Type?  Or something
else?
   begin --
      -- do file stuff
   end ada_proc;
pragma Export(C, ada_proc, "ada_proc");


Is there an easy/sane way to convert or use that C++ object as
File_Type?  Tried using
    type file_pointer is access file_type;  -- pointer operations
but was unsuccessful.  The file has to be opened in the C++ code, as the
only thing that can be sent to the Ada procedure is the pointer to
ifstream.

    Any info would be much appreciated.

    Justin Braach

--
"OVERKILL?!?  Look.  This ain't no game of 'Kick the Ouphe'..."
                                        -- Jaya Ballard
fxhunter@cs.montana.edu
http://www.cs.montana.edu/~fxhunter







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-02-19  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-19  0:00 Using C++ ifstream class in Ada95 Justin Braach

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