おいも貴婦人ブログ

生物系博士課程満期退学をしたAIエンジニアのブログ。

2015-06-18から1日間の記事一覧

ドメイン名からIPアドレスをゲットする。

Networkプログラミングの初歩の初歩。 とりあえずドメイン名から、IPを取得しましょう。 #include <stdio.h> #include <stdlib.h> #include <netdb.h> int main(void){ struct hostent *he; if((he=gethostbyname("www.google.com"))==NULL) exit(1); printf("---\n"); printf("%d.%d.%d.</netdb.h></stdlib.h></stdio.h>…