首页 > 试题广场 >

假设磁盘文件foobar.txt由6个ASCII码字符"f

[问答题]
 假设磁盘文件foobar.txt由6个ASCII码字符"foobar"组成,那么下列程序的输出是什么?
#include "csapp.h"
int main()
{
 int fd1, fd2;
  char c;
 fd1 = Open("foobar. txt", O_ RDONLY. 0);
  fd2 = Open("foobar . txt", O_ RDONLY, 0);
  Read(fd2, &c, 1);
  Dup2(fd2, fd1);
  Read(fd1, &c, 1);
 printf("c = %c\n", c);
 exit(0) ;
}


重定向,输出: c = o
发表于 2020-08-20 13:23:15 回复(0)