pastebin

Paste #81424: Untitled C paste by 113.108.133.61

#include "stdio.h"
#include "string.h"
#include "sys/time.h"
#include "unistd.h"
int main(void){
	int n=0;
	char input[55]="\0";
	struct timeval timeout;
	timeout.tv_sec=3;
	timeout.tv_usec=0;
	fd_set rdfds;
	FD_ZERO(&rdfds);
	FD_SET(0,&rdfds);
        setbuf(0, NULL);
	int ret=select(1,&rdfds,NULL,NULL,&timeout);
	if (ret<0) perror("select");
	if (ret==0) printf("it's timeout!\n");
	if (ret>0) {n=1;}
	if (n==1) {read(0,input,55);
	write(1,input,strlen(input));}}

Private
Wrap long lines

1 + 3 =