#include <unistd.h>  
#include <fcntl.h>  
#include <sys/types.h>  
#include <sys/stat.h>  
#include <fcntl.h>  
#include <errno.h>  
#include <sys/types.h>  
#include <sys/stat.h>  
#include <unistd.h>  
#include <stdio.h> 
#include <errno.h>  // errno 竟然是全局变量



int main() {  
    int fd = -1;  
    fd = open("./Makefile", O_RDONLY);  
    // close(fd);  
    if(fcntl(fd, F_GETFL))  
    {
        printf("%m  errno is %d %d\n",fd,errno);  
		errno = 3;
		printf("errno is %d\n",errno);
		printf("%m  errno is %d %d\n",fd,errno);  
		printf("fcntl success\n");
    }
	else 
	{
        printf("fcntl failure\n");
	}
    close(fd);  
	//while(1)
	//printf("file status\n");
	return 0;
}  

  linux 下面%m牛逼的操作

相关文章:

  • 2022-01-14
  • 2022-01-10
  • 2021-10-26
  • 2021-06-27
  • 2022-12-23
  • 2021-07-23
  • 2021-09-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2021-08-03
  • 2022-01-19
相关资源
相似解决方案