home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.questions:13520 comp.sys.hp:12993
- Newsgroups: comp.unix.questions,comp.sys.hp
- Path: sparky!uunet!utcsri!helios.physics.utoronto.ca!alchemy.chem.utoronto.ca!system
- From: system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson))
- Subject: Re: lib77 "flush" call. Where is it in UNIX?
- Message-ID: <1992Nov17.172955.27890@alchemy.chem.utoronto.ca>
- Organization: University of Toronto Chemistry Department
- References: <1992Nov17.122303.3080@cfa160.harvard.edu>
- Date: Tue, 17 Nov 1992 17:29:55 GMT
- Lines: 94
-
- In article <1992Nov17.122303.3080@cfa160.harvard.edu> bruce@head-cfa.harvard.edu (Bruce Sams) writes:
- >Dear fellow UNIX and HP-UX folks,
- >
- > I am trying to bring up the graphics package MONGO on our HP-720 machine
- > and I have encountered a problem. It seems that MONGO uses a "flush"
- > call deep in its IO guts. Looking through all the HP-UX libraries I
- > find no such routine. Rather, I find "pflushli", "flushinp", "intrflush",
- > "__cflush", "fflush", and "fflush_p." Some of these are clearly not
- > what I want, but others are less certainly wrong. I find no documentation
-
- You can write a "flush" that calls "fflush" (which is a standard C
- routine, and you should have a man page for it). You will need to use the
- HP-UX 'fstream' routine to map the FORTRAN unit number to a C stream number.
-
- I can't send you source for flush since it is licensed, but you can
- have these routines I used to make it work:
-
- function igetfstream (lunit)
- c
- c Purpose:
- c Return the FILE pointer corresponding to unit 'lunit',
- c or 0 if unit 'lunit' is not open.
- c
- logical opened
- c
- c
- c write (6,*) 'igetfstream called for unit ', lunit
- inquire (unit=lunit, opened=opened)
- if (opened) then
- igetfstream = fstream (lunit)
- if (igetfstream .eq. 0) then
- if (lunit .eq. 5) then
- igetfstream = igetstdin ()
- else if (lunit .eq. 6) then
- igetfstream = igetstdout ()
- else if (lunit .eq. 7) then
- igetfstream = igetstderr ()
- end if
- end if
- else
- igetfstream = 0
- end if
- c write (6,'(1x,a,z9.8)') 'igetfstream returning ', igetfstream
- return
- end
-
- To get the stream number for stdin/stdout/stderr, try:
-
- /*
- * Return the FILE pointer to stdin.
- */
-
- #include <stdio.h>
-
- FILE *
- igetstdin_ ()
- {
- return (stdin);
- }
-
-
- /*
- * Return the FILE pointer to stdout.
- */
-
- #include <stdio.h>
-
- FILE *
- igetstdout_ ()
- {
- return (stdout);
- }
-
-
- /*
- * Return the FILE pointer to stderr.
- */
-
- #include <stdio.h>
-
- FILE *
- igetstderr_ ()
- {
- return (stderr);
- }
-
-
- Note that always use "+ppu" for f77 compilations; you will need
- to remove the trailing '_' on the C routines if you don't.
-
- I have (cross-)posted this to comp.sys.hp.
- --
- What are the chances that any HP computer system will ever "work" properly?
- ... and Slim just left town. -*- Mike Peterson, SysAdmin, U/Toronto Chemistry
-