Skip to content

Instantly share code, notes, and snippets.

Created Apr 3, 2018
What would you like to do?
spew a char to stdout
/* 2018 Ralph Doncaster public domain software */
/* spew a char to stdout, null if none provided */
#include <unistd.h>
#include <string.h>
int main(int argc, char** argv){
char buf[1024];
char c = 0;
if( argc > 1 ) c = *argv[1];
memset( buf, c, sizeof(buf) );
while( write(1, buf, sizeof(buf)) > 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment