Created
March 10, 2013 12:12
-
-
Save Kwpolska/5128331 to your computer and use it in GitHub Desktop.
Windows Emulator (via http://www.reddit.com/r/ProgrammerHumor/comments/19yris/windows_being_helpful_as_always/ )
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
#include <stdlib.h> | |
#include <stdio.h> | |
int print_error(int errorcode) { | |
FILE *fp; | |
char cmd[100]; | |
char out[1000]; | |
sprintf(cmd, "NET HELPMSG %d'", errorcode); | |
fp = popen(cmd, "r"); | |
while (fgets(out, sizeof(out)-1, fp) != NULL) { | |
/* replace *** with service name here; I’m too lazy to write that here because C doesn’t have easy string replacement AFAIK, and if it doesn’t, share a link. */ | |
printf("%s", out); | |
} | |
pclose(fp); | |
printf("\nLess help is available by typing NET HELPMSG %d.\n\n\n", errorcode); | |
return 0; | |
} | |
int main() { | |
print_error(3521); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment