Entries from 2015-01-01 to 1 month
I was suffering with data structure alignment. But, I have found "#pragma pack(1)".argument: 1~16. It can be packed a element of memory.ex: #ifndef __ETH_H__ #define __ETH_H__ #include <iostream> class foo{ public: #pragma pack(1) struct sc{ ushort </iostream>…
Implementation of Frame was hard. I want a good library of Frame.The following code of Frame. // Ethernet header struct ethernet { u_char ether_dhost[ETHER_ADDR_LEN]; u_char ether_shost[ETHER_ADDR_LEN]; u_short ether_type; }; void Int2IPAd…
NOOOOOOOOOOOOOOOOO!!error code: char * func(){ char c[80] return c; }if char*, function return only array(head) pointer. therefore, data (place) is delete. because local variable. correct: void func(char *c){ c[0] = "a"; return; }Actually,…
Sizeof of "Pointer Char = char *c" and "Array Char = char c" are different.In the case of char*c, return byte of array.vice versa char c, return pointer size.The following experiment: #include <stdio.h> void func( char* ary, char list[] ) { printf(</stdio.h>…
A general procedure of programming is as follows. Coding -> make -> execution.This is troublesome. So, I would like to automate this.The following program detects a update of a file and carries out make -> execution automatically. require …
=Environment=OSX Yosemite(10.10.x) Terminal (default) gcc make =Confirmation of pcap=1. Open Terminal open default terminal 2. Check Pcap (libpcap) Firest make sure you have the latest Pcap (libpcap) installed on your OSX. $ man pcap PCAP(…
Hello, my name is Oneiroi. It's a pleasure to meet you. ENGRISSYU no benkyou no tameni hajime mashita. Do - Zo Yoroshiku Onegaishimasu :)