#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#define BUFSIZE 10
int main(int argc, char *argv[]) {
int i = 1
int bytesin
pid_t childpid
int pfd[2]
if (argc <2) {
fprintf(stderr, "Usage: %s command arg1 arg2 ...\n", argv[0])
return 1
}
if (pipe(pfd) == -1) {
perror("Failed to create the pipe")
return 1
}
bytesin = strlen(argv[1])
childpid = fork()
if (childpid == -1) {
perror("Failed to fork")
return 1
}
while (argv[i] != NULL) {
if (childpid) {
if (write(pfd[1], argv[i], strlen(argv[i])) != -1)
printf("parent write over.\n")
}else {
bytesin = read(pfd[0], argv[i], BUFSIZE)
fprintf(stderr, "[%ld]: %.*s\n", (long) getpid(), bytesin, argv[i])
}
++i ############关键是这里
}
return 0
}
外观设计时尚,轻薄便携,性能配置均匀,适合女孩子的:1型号:联想S410-ITH(H)云帆白 ¥3400(阿玛逊:3399)
酷睿i3 4010U/4GB/500GB/2GB R5 M230/Linux//珍珠白//14寸//外观//轻薄//21mm//1.8Kg
2型号:联想S410-IFI(L)云帆白 ¥4050(实体店:3880)
酷睿i5 4200U/4GB/500GB/2GB R5 M230/Linux//云帆白//14寸//外观//轻薄//21mm//1.8Kg
3型号:三星450R4V-XH3 ¥3200(阿玛逊:3079)
酷睿i3 3110M/4GB/500GB/2GB 710M/DOS/白色//14寸//外观//轻薄//22.9mm//1.81Kg
1型号:宏基Acer V5-573G-54204G50akk(GT720M)¥3700(阿玛逊:3580)酷睿i5 4200U/4GB/500GB/2GB GT720/Win8/银//15寸//外观//轻薄//背光键盘//20.75mm//2Kg
2型号:联想S410-ITH(H)云帆白 ¥3400(阿玛逊:3399)
酷睿i3 4010U/4GB/500GB/2GB R5 M230/Linux//珍珠白//14寸//外观//轻薄//21mm//1.8Kg
3型号:三星450R4V-XH3 ¥3200(阿玛逊:3079)
酷睿i3 3110M/4GB/500GB/2GB 710M/DOS/白色//14寸//外观//轻薄//22.9mm//1.81Kg
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)