Skip to content

Instantly share code, notes, and snippets.

@qlkzy
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save qlkzy/9811281 to your computer and use it in GitHub Desktop.

Select an option

Save qlkzy/9811281 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <assert.h>
int main()
{
const char *myfifo = "/var/myfifo";
FILE *fifoin = fopen(myfifo, "r");;
int c;
assert(fifoin);
for (;;) {
while(c = fgetc(fifoin), c != EOF) {
printf("%02x ", c);
}
fflush(stdout);
}
}
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
char notes[12] = {0x90, 36, 0x7F, 0x90, 40, 0x7F, 0x90, 43, 0x7F, 0x90, 40, 0x7F};
int main ()
{
int fd = open("/var/myfifo", O_WRONLY | O_NONBLOCK);
write(fd, notes, sizeof(notes));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment