报名参加的理由是:
书山有路勤为径,一切为了爬山
我的学习计划是:
1、买本书
2、和大家一起学
3、学以致用
我的购书链接是:
https://item.jd.com/11821338.html
2018年5月19日学习记录
带着问题去学习,今天遇到一个问题,如何获得一个域名的ip地址,网上查询了一些资料,配合自己的开发调试工具
#include <stdio.h> #include <netdb.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { struct hostent *h; if((h=gethostbyname("mikuq.com"))==NULL) { fprintf(stderr,"不能得到IP\n"); return 1; } printf("%s\n",inet_ntoa(*((struct in_addr *)h->h_addr))); return 0; }
实际调试环境
根据百度百科:https://baike.baidu.com/item/BCD%E7%A0%81
BCD码可分为有权码和无权码两类:有权BCD码有8421码、2421码、5421码,其中8421码是最常用的;无权BCD码有余3码,余3循环码等。
在这里我们选用最常用的8421码吧,也就是 1000 0100 0010 0001 <==> 8421,用这个作为测试用例