Skip to content

Instantly share code, notes, and snippets.

@bshastry
Created April 19, 2018 09:29
Show Gist options
  • Save bshastry/33e94a91823c19c00dbad9c71b3202c4 to your computer and use it in GitHub Desktop.
Save bshastry/33e94a91823c19c00dbad9c71b3202c4 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define BUF_SIZE 1024
#define TEST_STR "test"
void parse(char *buf) {
if (strcmp(buf, TEST_STR))
printf("parsed test\n");
}
int main() {
void *buf = malloc(BUF_SIZE);
read(0, buf, BUF_SIZE);
parse((char *)buf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment