File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed 
judge/runpipe_test/S_closes_stdin Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ #define  _XOPEN_SOURCE  700
2+ 
13#include  <stdio.h> 
24#include  <signal.h> 
5+ #include  <unistd.h> 
6+ #include  <time.h> 
37
48int  main () {
59  signal (SIGPIPE , SIG_IGN );
610
7-   usleep (500000 );
11+   struct  timespec  req  =  {0 };
12+   req .tv_nsec  =  500000000L ; // 0.5 seconds 
13+   nanosleep (& req , NULL );
14+ 
815  printf ("123\n" );
916  fflush (stdout );
1017  int  x ;
11-   scanf ("%d" , & x );
18+   if  (scanf ("%d" , & x ) !=  1 ) {
19+     return  1 ;
20+   }
1221  if  (x  ==  42 )
1322    return  42 ;
1423  return  43 ;
Original file line number Diff line number Diff line change 1+ #define  _XOPEN_SOURCE  700
2+ 
13#include  <stdio.h> 
4+ #include  <unistd.h> 
5+ #include  <time.h> 
26
37int  main () {
48  fclose (stdin );
59  printf ("42\n" );
6-   usleep (800000 );
10+ 
11+   struct  timespec  req  =  {0 };
12+   req .tv_nsec  =  800000000L ; // 0.8 seconds 
13+   nanosleep (& req , NULL );
714}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments