Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!lll-winken!taco!news!henkel%nepjt From: henkel%nepjt@ncsuvx.ncsu.edu (Chuck Henkel) Newsgroups: comp.unix.aix Subject: Passing character data from Fortran to C Message-ID: Date: 22 Jun 91 07:27:18 GMT Sender: news@ncsu.edu (USENET News System) Reply-To: henkel@nepjt.ncsu.edu (Chuck Henkel) Organization: North Carolina State University, Raleigh Lines: 31 I'm trying to write a Fortran wrapper around the C "getenv" routine, and need to pass character data between Fortran and C. I had in mind something like this: character*40 var, value var = 'USER'//char(0) call getenval (var, value) write (*,*) 'Value = ', value end With: #include #include void getenval (char *ename, char *evalue) { strcpy(evalue,getenv(ename)); return; } But, of course it doesn't work. - I tried putting %REF()s around the arguments in the getenval call. - Info talks about a builtin version of getenv for fortran, but it doesn't have the same functionality as C getenv. -- | Chuck Henkel | There are currently 111 operating | | Department of Nuclear Engineering | nuclear power plants in the US, | | N.C. State University | generating nearly 100,000 Megawatts | | henkel%nepjt@ncsuvx.ncsu.edu | of electricity. |