镜空勿朴

镜空勿朴,第1张

镜空勿朴

#include
#include
#include
#include
#define MSG_LEN 256
int main(int argc, char *argv)
{
int num, fd;
char msg[MSG_LEN+1];
if (argc == 1)
return EXIT_FAILURE;
/
open the file /
if ((fd=open(argv[1], O_RDONLY, 0)) < 0)
return EXIT_FAILURE;
do{
/
read the file /
if ((num = read(fd, msg, MSG_LEN)) < 0) {
close(fd);
return EXIT_FAILURE;
} else if (num == 0) {
break;
}
/
display on screen /
msg[num] = ‘’;
printf("%s", msg);
}while(1);
printf("n");
/
exit */
close(fd);
sync();
return EXIT_SUCCESS;
}

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5636524.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-16
下一篇2022-12-16

发表评论

登录后才能评论

评论列表(0条)

    保存