This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import urllib | |
| webpage = urllib.urlopen('http://www.baidu.com') | |
| pagefile = open('baidu.html', 'w') | |
| for lines in webpage.readlines(): | |
| pagefile.write(lines) | |
| pagefile.close() | |
| webpage.close() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| #include <dirent.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| DIR *dp; | |
| struct dirent *dirp; | |
| if (argc != 2) | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| #define BUFFSIZE 4096 | |
| int main() | |
| { | |
| int n; | |
| char buf[BUFFSIZE]; | |
| while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| int main() | |
| { | |
| int c; | |
| while ((c = getc(stdin)) != EOF) | |
| { | |
| if (putc(c, stdout) == EOF) | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| int main() | |
| { | |
| printf("hello world from process ID %d\n", getpid()); | |
| return 0; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| #include <sys/wait.h> | |
| int main() | |
| { | |
| char buf[MAXLINE]; | |
| pid_t pid; | |
| int status; | |
| printf("%% "); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| #include <errno.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| errno = E2BIG; | |
| printf("E2BIG: %s", strerror(errno)); | |
| errno = EAGAIN; | |
| perror(argv[0]); | |
| return 0; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| int main() | |
| { | |
| printf("uid = %d, gid = %d\n", getuid(), getgid()); | |
| return 0; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| #include <sys/wait.h> | |
| static void sig_int(int signo); | |
| int main() | |
| { | |
| char buf[MAXLINE]; | |
| pid_t pid; | |
| int status; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include "apue.h" | |
| int main() | |
| { | |
| if (lseek(STDIN_FILENO, 0, SEEK_CUR == -1)) | |
| { | |
| printf("cannot seek\n"); | |
| } | |
| else | |
| { | 
OlderNewer