Name: Anonymous 2013-10-20 22:56
Post a random function that you made. May be from any project you've done or make one impromptu.
Any QUALITY is allowed. No bullying!
Any QUALITY is allowed. No bullying!
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
void *error(char *f, char *fmt, ...) {
va_list args;
va_start(args, fmt);
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
va_end(args);
if(f)
perror(f);
exit(1);
}
int main(int argc, char **argv) {
int c;
FILE *f;
(f = fopen(*++argv, "r")) || error("fopen", "Couldn't open %s", *argv);
while((c = fgetc(f)) != EOF)
putchar(c);
return(0);
}