freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

習(xí)題答案全linux-資料下載頁

2025-06-25 20:19本頁面
  

【正文】 f(argc!=3) { printf(argument error\n)。 exit(1)。 } from=open(argv[1],O_RDONLY)。 to=open(argv[2],O_WRONLY|O_CREAT|O_TRUNC,0644)。num=read(from,buf,10)。while(num!=0){ write(to,buf,num)。 num=read(from,buf,10)。} close(from)。 close(to)。}1.,將字符串“hello world”通過輸出重定向方式寫入文件f1中include include include include sys/include sys/main(){ int fd。 if((fd=open(f1,O_WRONLY|O_CREAT,0644))==1) perror(open fail)。 if(dup2(fd,1)==1) perror(Redirect failed)。 printf(Hello world\n)。 close(fd)。}第六章 編程題 略。1.使用fork創(chuàng)建進(jìn)程,在子進(jìn)程中打印“I am the child”和子進(jìn)程pid,在父進(jìn)程中打印“I am the father”和父進(jìn)程pidinclude sys/include include int main(){ pid_t pid。 pid = fork()。 if(pid 0) { perror(fork)。 exit(1)。 } else if(pid == 0) printf(I am the child\n)。 else printf(I am the father\n)。 exit(0)。}2.創(chuàng)建子進(jìn)程,在子進(jìn)程中執(zhí)行“ps A”命令,父進(jìn)程等待子進(jìn)程結(jié)束后打印“child over”及所處理的子進(jìn)程進(jìn)程號include sys/include main(){ pid_t pid,cpid。 int i。 char* args[64]。 args[0]=”ps”。 args[1]=”A”。 args[2]=NULL。 pid=fork()。 if(pid0) { perror(“fork”)。 exit(1)。 } else if(pid==0) { execvp(args[0],args)。 exit(0)。 } else { cpid=wait(NULL)。 printf(“child over! cpid=%d\n”,cpid)。 }}第八章 編程題略1.編寫程序處理SIGINT信號,當(dāng)程序接收到SIGINT信號后輸出“SIGINT is caught”include include void signal_handler(int signum){ switch(signum) { case SIGINT: printf(SIGINT is caught!\n)。 break。 } }int main(){ signal(SIGINT,signal_handler)。 pause()。 return 0。}2.略3.使用PIPE時限父子進(jìn)程向子進(jìn)程發(fā)送1234567890,子進(jìn)程接收并顯示include sys/include main(){ int pfd[2]。 char buf[32]。 pid_t pid。 pipe(pfd)。 if((pid=fork())0) perror(fork)。 else if(pid0) { close(pfd[0])。 write(pfd[1],1234567890,11)。 } else { close(pfd[1])。 read(pfd[0],buf,11)。 printf(child read:%s\n,buf)。 }}4.略
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1