/*
* main.c
*
* Created on: 2024-6-10
* Author: root
*/
#include
#include
#include
#include
#include
#define LENGTH 2000
int main()
{
char c[LENGTH];
int f,i;
puts("input will save file information: ");
if((i=read(0,c,LENGTH))<1)
{
perror(" read failed !");
return 1;
}
f=open("outfile",O_RDWR|O_CREAT,0664);
if(f!=-1)
{
if(write(f,c,i)!=i)
perror("write failed !");
puts("save file succeed !");
close(f);
}
else
perror("open file");
return 0;
}
文章评论(0条评论)
登录后参与讨论