main.c

来自「FPGA中的设计全过程」· C语言 代码 · 共 26 行

C
26
字号
/*
 * main.c : test demo driver
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
int main()
{
	int i = 0;
	int dev_fd;
	dev_fd = open("/dev/simple",O_RDWR | O_NONBLOCK);
	if ( dev_fd == -1 ) {
		printf("Cann't open file /dev/simple\n");
		exit(1);
	}
	ioctl(dev_fd,1,0);
	getchar();
	ioctl(dev_fd,2,0);
	close(dev_fd);
	return 0;
}

⌨️ 快捷键说明

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