home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!wahler
- From: wahler@Informatik.TU-Muenchen.DE (Bernhard Wahler (D MS))
- Subject: C to Fortran , Character Strings
- Originator: wahler@hpzenger1.informatik.tu-muenchen.de
- Sender: news@Informatik.TU-Muenchen.DE (USENET Newssystem)
- Organization: Technische Universitaet Muenchen, Germany
- Date: Mon, 17 Aug 1992 08:29:30 GMT
- Message-ID: <1992Aug17.082930.22597@Informatik.TU-Muenchen.DE>
- Lines: 52
-
-
-
-
- Hello everybody, I've got a problem with character strings
- in FORTRAN. I have to translate a C-prg into a FORTRAN-prg.
- and everything is working fine so far.
- On a HP there is the ALIAS-Directive to tell the fortran-compiler
- how to pass parameters. I tried this and it worked.
-
- But how can I get
- get a C-character string, which is returned by my C-function
- "msys_rcv()" ( see below ) into a fortran-type and work with it
- ( print it ).
-
- Any help would be appreciated. Thanks in advance,
-
- Bernhard Wahler
-
- wahler@dszenger10.informatik.tu-muenchen.de
-
-
-
- ---------------- C-Code --------------------------
-
- char *RECEIVE( long *size, long *channel )
- {
- char *mess;
- -> if ((mess = msys_rcv( WAIT, size, channel ))!=NULL) {
- printf("Msg-Laenge : %ld\t", *size );
- printf("Channel : %ld\t", *channel );
- printf("Erstes Byte : %c\n", mess[0] );
- printf("Letztes Byte : %c\n", mess[*size-1] );
- msys_free(mess);
- }
- return mess;
- }
-
- -------------- FORTRAN-Code ----------------------
-
- $ALIAS CC3 = 'msys_rcv' (%val,%ref,%ref)
-
- subroutine RECEIVE( mess )
- character mess*(*)
- integer*4 size, channel
- integer MSYS_NOWAIT
- parameter( MSYS_NOWAIT = 1 )
- ----> mess = CC3( MSYS_NOWAIT, size, channel )
- end
-
-
- Keywords:
-
-