Conversation
|
Thanks Chris. Do we know if this works on all platforms? |
|
I am not certain. |
There was a problem hiding this comment.
Looks like there's a minor whitespace issue here.
There was a problem hiding this comment.
Funny, the whitespace doesn't show up incorrectly on my computer. Probably some issue with my vim configuration.
|
|
|
@stevedekorte It looks like it's supported at least on FreeBSD, Linux, OSX, and Solaris. |
|
Can anyone test it on Windows? |
|
Looks like it's deprecated on Windows.
|
|
If someone would like to mod the patch to work on windows, I can accept it. |
|
Hope you don't mind me jumping in but:
So I think you just need a solution for OS X, probably using |
|
Quick thought on using #include <stdio.h>
int main(void) {
static char answer[1024];
FILE* fp = popen("dig|grep SERVER:", "r");
if (fp) {
fread(answer, 1, 1024, fp);
/* Do something with 'answer' ... */
puts(answer);
pclose(fp);
} else {
/* Error */
}
}Tested on Linux, not yet on OS X. |
According to here you should not use
tmpnam. I am not familiar with Socket programming, so I am not sure how to test. I believe I have fixed it by replacing it withmkstemp, but I'm not completely sure. Nevertheless, this is an issue that should be addressed.