|
用read /dev/ttyv1 - #include <stdio.h>
- #include <unistd.h>
- int
- main(int argc,char **argv)
- {
- FILE *fp;
- int c;
- if(argc != 2 ) {
- printf("Usage : %s <terminal>\n",argv[0]);
- exit(1);
- }
- if((fp=fopen(argv[1],"r"))<0) {
- perror("open error");
- exit(1);
- }
- for ( ; ; ) {
- fflush(stdin);
- fflush(stdout);
- while((c=fgetc(fp)) != NULL )
- fputc(c,stdout);
- fflush(stdin);
- fflush(stdout);
- }
- fclose(fp);
- return(0);
- }
复制代码 目的:
怎么把终端的标准输出和错误输出复制一份给另一个终端? |
|