Last active
August 29, 2015 13:57
-
-
Save qlkzy/9811281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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