Created
April 3, 2018 15:24
-
-
Save nerdralph/2c73fea47d69443e9c584176b2d7f72f to your computer and use it in GitHub Desktop.
spew a char to stdout
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
/* 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