Skip to content

Instantly share code, notes, and snippets.

@Bueddl
Created September 28, 2016 23:32
Show Gist options
  • Save Bueddl/9e750f82efb5f9ea708a4a7d74707c68 to your computer and use it in GitHub Desktop.
Save Bueddl/9e750f82efb5f9ea708a4a7d74707c68 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(int argc, char const *argv[], char const *envp[])
{
int i;
char **env;
FILE *fp;
fp = argc == 2 ? fopen(argv[1], "w") : stdout;
for (i = 0; i < argc; ++i)
fprintf(fp, "argc[%d] = '%s'\n", i, argv[i]);
for (env = envp; *env; ++env)
fprintf(fp, "%s\n", *env);
// none closing
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment