Xref: utzoo comp.lang.fortran:5680 comp.sys.ibm.pc.programmer:2766 Path: utzoo!utgpu!news-server.csri.toronto.edu!news-server.ecf!me!sun Newsgroups: comp.lang.fortran,comp.sys.ibm.pc.programmer From: sun@me.utoronto.ca (Andy Sun) Subject: MS Fortran calling C function GETENV Message-ID: <91Jun12.114559edt.19128@me.utoronto.ca> Organization: U of Toronto, Dept. of Mechanical Engineering Date: 12 Jun 91 15:46:03 GMT This sounds absurd but it is really what happened. I am using Microsoft Fortran 5.00 and need to use GETENV. I flipped through all the manuals (well, almost all, I didn't bother checking the edtior user's guide) and couldn't find any reference to GETENV (they have SYSTEM and SPAWNLP only). The "Advanced Topics" menu have this line: "The FORTRAN run-time libraries MLIBFORx.LIB and LLIBFORx.lib include the system routine and a subset of the spawnlp routine (as well as other routines) originally from the C library. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Can someone who bought MS Fortran tell me if you find the list of "as well as other routines" anywhere is the manual? I can't. I might have overlooked it but I am pretty sure at least the indices do not have this. Anyway, I guessed they might have GETENV (since they have GETTIM and GETDAT) and went by trial-and-error to create the interface module like the following: interface to character*80 funtion getenv[c] & (string[reference]) character*1 string end and the calling program character*80 getenv character*10 var var = getenv ("PROMPT"c) end and it compiled and ran. My question is: do I have to specify character*80 for GETENV or I can do it dynamically? Just putting character does not seem to work. I can see why I have to explicitly declare variable 'var', but I am suspicious about the function call itself. Is a string of 80 characters enough? Too much? I would appreciate it if someone can give me the answer to this or at least educated guesses (mine aren't. They are semi-blind guesses based on MS C getenv function call arguments). Andy