Difference between revisions of "USB Roll-up drum kit user-space driver for linux"
From Organic Design wiki
m |
(just reads from the pipe for now) |
||
Line 5: | Line 5: | ||
#include <stdlib.h> | #include <stdlib.h> | ||
#include <unistd.h> | #include <unistd.h> | ||
+ | |||
+ | |||
+ | struct rec { | ||
+ | int x,y,z; | ||
+ | }; | ||
+ | |||
+ | int main() { | ||
+ | |||
+ | FILE *f; | ||
+ | int i,j; | ||
+ | struct rec r; | ||
+ | |||
+ | f=fopen("/dev/random","r"); | ||
+ | |||
+ | while(fread(&r,sizeof(struct rec),1,f) != 0) | ||
+ | printf("%d\n",r.x); | ||
+ | |||
+ | |||
+ | fclose(f); | ||
+ | |||
+ | printf("\n"); | ||
+ | |||
+ | |||
+ | } | ||
</pre> | </pre> |
Revision as of 03:12, 21 January 2009
- See the talk page for development notes.
#include <stdio.h> #include <stdlib.h> #include <unistd.h> struct rec { int x,y,z; }; int main() { FILE *f; int i,j; struct rec r; f=fopen("/dev/random","r"); while(fread(&r,sizeof(struct rec),1,f) != 0) printf("%d\n",r.x); fclose(f); printf("\n"); }