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

int
main(int argc, char *argv[])
{
	int i = 0;
	int fd = -1;
	char *ghedev = "/dev/ghe";
	char buf[1024];
	ssize_t rs;


	if ((fd = open(ghedev, O_RDWR)) < 0)
	{
        	perror(ghedev);
		exit(1);
	}

again:
	i++;
	memset(buf, 0, sizeof(buf));
	sprintf(buf, "%d", i);
	rs = write(fd, buf, strlen(buf));
	printf("write rs = %d \n", rs);

	if (getchar() == '\n')
		goto again;
	

	if (fd > 0)
		close(fd);

	return 0;
}




