Sandy on Tue, 4 Jan 2000 21:45:51 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] non buffered c program


i am trying to write a program that counts words and would prefer the user
not having to hit return.
i have tried to use setvbuf but it is not working.  does anyone know how to
use this?
enclosed is my listing:

include<stdio.h>
#include<stdlib.h>
int main()

{
FILE *out;
size_t zero_t=0;
int ch;
int iret;
iret=9;
iret=setvbuf(stdin,NULL,2,zero_t);
printf( "ret %d \n",iret);
iret=9;
iret=setvbuf(stdout,NULL,2,zero_t);
printf( "out ret %d \n",iret);

while ((ch=getc(stdin))!=EOF) 
  {	

putc(ch,stderr);
  }
//printf("\n");
return 0;
}




_______________________________________________
PLUG maillist  -  PLUG@lists.nothinbut.net
http://lists.nothinbut.net/mail/listinfo/plug