Skip to content

Instantly share code, notes, and snippets.

@nerdralph
Created April 3, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nerdralph/2c73fea47d69443e9c584176b2d7f72f to your computer and use it in GitHub Desktop.
Save nerdralph/2c73fea47d69443e9c584176b2d7f72f to your computer and use it in GitHub Desktop.
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