Xref: utzoo comp.lang.c++:1964 comp.lang.fortran:1502 Path: utzoo!attcan!uunet!mcvax!hp4nl!rivm!ccea3 From: ccea3@rivm.UUCP (Adri Verhoef) Newsgroups: comp.lang.c++,comp.lang.fortran Subject: Re: f77 and C++ w/ cin/cout: can it be done? Summary: yes Keywords: f77 C++ cin cout printf Message-ID: <1125@rivm05.UUCP> Date: 12 Nov 88 02:02:17 GMT References: <1118@rivm05.UUCP> Reply-To: ccea3@rivm05.UUCP (Adri Verhoef) Organization: RIVM, Bilthoven, The Netherlands Lines: 44 Thanks, world! I put an example in a possible solution: >- I have this fortran-file "m.f": subroutine f call hello() end >- and I have this C++-file "s.c": >#include main() { extern void f_(); f_(); } >void hello_() >{ > STATEMENTS; >} >- I compile "m.f": >$ f77 -c m.f > >- I replace STATEMENTS by: char str[256]; printf("__printf__Hello, %s\n", "world"); cout << " __cout__ Type your name: "; cin >> str; cout << " __cout__ Hello, " << str << ".\n"; >- Then I compile "s.c", and execute a.out: $ CC s.c m.o -lF77 -lI77 >$ a.out __printf__Hello, world __cout__ Type your name: a3 __cout__ Hello, a3. And everything runs as expected (namely OK). A certain point of attention is that I changed "program main" into "subroutine f". That really helped. PS. Thanks to all who helped so quickly, especially Marty Shannon, and also Dag Bruck. Good work!