[comp.sys.amiga.programmer] Problems with SAS/Lattice line buffered stdio

umueller@iiic.ethz.ch (Urban Dominik Mueller) (03/25/91)

Being only a casual SAS/Lattice C user, I just ran across a problem with
the  the  buffering  of  Level  2  files.  In the SAS library, stdin and
stdout are unbuffered by default.  The wrong choice in my opinion.  Thus
I  tried to set the line buffered mode for those two files.  After that,
however,  only the fputs() and fputc() functions behaved correctly.  The
manual announces that puts() and putc() don't work, bad enough, but they
can  be  replaced  by  fputs()  and  fputc().   What  I'm  interested is
printf().  I found no way to make it work, neither by #undef printf, nor
by  replacing  it  with  fprintf(stdout).   Here  comes  the non-working
example:
 
#include <stdio.h>
 
main()
{
    setvbuf(stdout,NULL,_IOLBF,BUFSIZ));
    fprintf(stdout,"hi ");                /* <-- printed immediately! */
    Delay(30);
    fprintf(stdout,"ho\n");
}
 
Is  there  anybody  out  there  in net.land who knows a way to make this
work? Additionally, does anybody know an e-mail of SAS institute?
                                          __
 |          Urban Mueller         |      / / |    Urban Mueller    |
 | INTERNET:umueller@iiic.ethz.ch | __  / /  |    Schulhausstr. 83 |
 | FIDONET: 2:302/906 (AUGL)      | \ \/ /   | CH-6312 Steinhausen |
 | "Don't tell my employer"       |  \__/    |    SWITZERLAND      |