#include
#include
#include
#include
#include
#include
#include
int main() { int fd,i,nwrite,nread; char *buf = "hello/n"; char read_buf[6] = {0}; fd = open("/dev/fs",O_RDWR); if( fd <= 0 ) { perror("open"); exit(1); }else printf("open ok!"); nwrite = write(fd,buf,strlen(buf)); if( nwrite < 0 ) { perror("write"); exit(1); } nread = read(fd,read_buf,6); if( nread < 0 ) { perror("read"); exit(1); } else printf("read is %s/n",read_buf); close(fd); exit(0); } //查看结果 // /var/log/messages
linux 嵌入式驱动程序测试实例
最新推荐文章于 2023-06-23 19:20:19 发布