On Thu, 31 Aug 1995 19:35:08 -0400 Geoff Harper <[log in to unmask]> asked: > > Can someone explain where C's printf sends its data to, and how it > arrives at selecting the destination? > I have C programs in cgi-bin that run under our web server for forms > processing - they work fine, doing fgetc and printf for I/O with the > POST method. ..snipped.. > > Now, when compiled under the POSIX shell, the printfs go to the > web browser, but the PRINT intrinsic goes to the $STDLIST of the web > server job. When compiled at the MPE prompt (and then using the MPE > NEWLINK command to establish a link to the program in cgi-bin directory), > both the printfs and the PRINT go to the $STDLIST of the web server job. I found the same result with POSIX and MPE compiled programs. > If you run this program interactively at either the shell or the > MPE prompt, the PRINT will appear before the printfs, so they're obviously > not getting to the screen the same route. > What I'm trying to accomplish is to have a COBOL (yes... I know, why?) > program, compiled at the MPE prompt, with a file link in cgi-bin > directory (I *have* to link it - it aborts if I simply copy it over there > and try to run it) to handle some POST method forms processing. > Can someone tell me if/how I might be able to direct my COBOL output > to the same channel printf is using to get to the web browser? I had a similar problem. Although I'm using 'C' I must run an CI compiled program, not Posix compiled as I am reading Image databases, and as far as I've heard, you can't do this with a Posix program. Here is the cgi script for our registration course tally page. (http://delphi.capcollege.bc.ca/reg.html) I think it could be nominated for 'kludge of the year', but it works. Delphi:l /WWW/WWW/httpd_1.3/cgi-bin/get-reg #!/bin/sh echo Content-type: text/html echo echo $QUERY_STRING > /tmp/$PPID callci WWWTALLY.PROG.WWW $PPID > NUL cat /tmp/$PPID rm /tmp/$PPID ---- Notes: Not using forms, just a searchable index(ie ISINDEX HTML tag). $PPID is a shell variable that(as far as I can tell) is different for each HTTP lookup. This takes care of simultaneous queries. Put the user's query into a temp file called /tmp/$PPID, supply this on the command line(ie info string) to the program and callci it. (A program run from callci doesn't have access to the shell QUERY_STRING env variable). The program opens the file name supplied and reads the search argument. (the program knows enough to prepend a /tmp/ to it). Then reopens the file for write and writes out the response to the query(with HTML tags) to the file. Script then 'cat's this file to the Web Page. This may provide some clues for a workaround. Bob. --=--=-- Bob Walker, Computer Centre -- [log in to unmask] Capilano College, North Vancouver, BC, CANADA.