????1???????????
??????????????????д???????????????????????á????????????????????????????????????????????????????????????????????????????????????д????????????open??create???????????????????????????????????????read??write??????
????2??write????
????write???????????£?
????#include < unistd >
????ssize_t write(int filedes?? void *buf?? size_t nbytes);
????// ?????????????д???????????????????-1
????// filedes???????????
????// buf:??д???????????
????// nbytes:?д????????
????
write?????????????

#include <error.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
int main()
{
    int fd = open("./write.txt"?? O_WRONLY  | O_CREAT?? 0666);
    if (-1 == fd){
        perror("open file error");
        return;
    }
    char* buff = "write data to file!";
    ssize_t writelen = write(fd?? buff?? strlen(buff));
    printf("%d "?? writelen);
    close(fd);
    return 0;
}
????3??read????
????read???????????£?
????#include < unistd >
????ssize_t read(int filedes?? void *buf?? size_t nbytes);
????// ??????????????????????????????????β????0???????????-1
????// filedes???????????
????// buf:????????????
????// nbytes:???????????
?????м???????????????????????????????????????
????1?????????????????????????????????????????????磬???????????????????30????????????100????????read????30????????????read???????????0???????????
????2??????????豸??????????ζ????С?
????3???????????????????е??????????????????С?????????????????
????4??????????FIFO??????????????????????????????????????read?????????????????????
????5???????Щ?????????豸?????????????????ζ???????????
????6???????????????ж????????????????????
????
read?????????????
#include <error.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
int main()
{
    int fd = open("./read.txt"?? O_RDONLY | O_CREAT?? 0666);
    if (-1 == fd){
        perror("open file error");
        return;
    }
    char buff[1024];
    memset(buff?? 0?? sizeof(buff));
    ssize_t readlen = read(fd?? buff?? 1024);
    printf("%s"?? buff);
    printf("%d "?? readlen);
    close(fd);
    return 0;
}