Last active
August 29, 2015 14:13
-
-
Save ryanchapman/793492f77728eec466f1 to your computer and use it in GitHub Desktop.
write a string to standard output using syscall(2)
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
/* save as test.c, compile with gcc test.c -o test -m64 */ | |
#define _GNU_SOURCE /* See feature_test_macros(7) */ | |
#include <unistd.h> | |
#include <sys/syscall.h> /* For SYS_xxx definitions */ | |
void main() { | |
const char *buf="test\n"; | |
syscall(1, /* sys_write */ | |
1, /* stdout */ | |
buf, /* buf, or string to write to stdout */ | |
5 /* num of chars in buf */ | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment