1.思维导图
2.不太会
#include "head.h"
int main(int argc, const char *argv[])
{int fd=open("../xiaoxin.bmp","O_RDONLY");if(fd==-1)printf("open error");//大小struct stat st;if(stat("../xiaoxin.bmp",&st)==-1)PRINT_ERROR("stat error");printf("size=%ld\n",st.st_size);//偏移量off_t offset;off_t size=lseek(fd,offset,SEEK_SET);ssize_t res=read(fd,&offset,4);printf("offset=%ld\n",offset);//宽度//高度return 0;
}
3.不对
#include "head.h"
int main(int argc, const char *argv[])
{DIR* dp=opendir("../ketang/01_open.c");if(dp==NULL)printf("opendir error");struct stat st;switch(st.st_mode& S_IFMT){case S_IFSOCK:printf("socket");break;case S_IFLNK:printf("symbolic");break;case S_IFREG:printf("regular");break;case S_IFBLK:printf("block");break;case S_IFDIR:printf("directory");break;case S_IFCHR:printf("character");break;case S_IFIFO:printf("FIFO");break;}printf("mode=%#o\n",st.st_mode&0777);return 0;
}