2005年3月アーカイブ

名称 ポート番号
plane ssl/tls
HTTP 80 443
FTP data 20 989
FTP 21 990
Telnet 23 992
IMAP 143 993
IRC 194 994
SMTP 25 465
POP3 110 995
NNTP 119 563
LDAP 389 636

前回は、修行が足りなかったみたい。
union なんて必要ありません。
メモリ上のデータの並びがわかります。
Intel だったらリトルエンディアン

#include
#include

typedef unsigned char BYTE;

using namespace std;

int main()
{
double d;
d = 1.0;
BYTE *b = reinterpret_cast(&d);

// ビッグエンディアン
for (int i = 0; i < sizeof(double); ++i)
cout << setw(2) << setfill('0') << hex << static_cast(*(b + i));

cout << endl;

// リトルエンディアン
for (int i = sizeof(double); i != 0; --i)
cout << setw(2) << setfill('0') << hex << static_cast(*(b + i));

cout << endl;

return 0;
}

カテゴリ

ウェブページ

このアーカイブについて

このページには、2005年3月に書かれたブログ記事が新しい順に公開されています。

前のアーカイブは2005年1月です。

次のアーカイブは2005年7月です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。