c语言,文件读取,转换成文字,盗墓者是个丑奴儿

//盗墓者是个丑奴儿,原

//博主个人网站 :https://daomu.kaige123.com

//打完一波小广告,进入正题

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

//open打开文件,read读取文件字节,交给char,输出char[]

int main(void){

        int i=open("stu.java",O_RDWR);

        char buf[100]={0};
        read(i,buf,sizeof(buf));

        printf("%s \n",buf);

        close(i);

        return 0;

}
 

运行结果:

猜你喜欢

转载自blog.csdn.net/java_dmz/article/details/81207027