Last active
April 15, 2016 16:13
-
-
Save xpn/818cd1ce474e86adc23eb62637d56e6b to your computer and use it in GitHub Desktop.
This file contains 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 <fcntl.h> | |
#include <unistd.h> | |
#include <string.h> | |
void print_success(void *input) { | |
if (*(char *)(input+1) == 'Y') { | |
printf("GOT: %s\n", input); | |
return; | |
} | |
return; | |
} | |
void test(void *input) { | |
char buffer[1024]; | |
if (*(char *)input == 'Z') { | |
strcpy(buffer, input); | |
print_success(buffer); | |
return; | |
} | |
printf("FAIL\n"); | |
return; | |
} | |
int main(int argc, char **argv) { | |
char buffer[9076]; | |
int fd = open(argv[1], O_RDONLY); | |
read(fd, buffer, 9076); | |
test(buffer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment