hello.c

来自「我自己写的2.4版本下的驱动程序」· C语言 代码 · 共 37 行

C
37
字号
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/mman.h>

#include "type.h"

#define hello_open 1

int main(void)
{
	int fd_hello;
	//open the driver
	fd_hello =open("/dev/hello", O_RDWR);
	if(fd_hello<0)
	{
		printf("hello open error\n");
		return 1;
	}
		
	ioctl(fd_hello,hello_open,0);
	printf("hello_open\n");
	close(fd_hello);
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?