Linux 判断机器的字节顺序
#include <fcntl.h>
int main(void)
{
typedef union un{
short s;
char c[sizeof(short)];
}un;
un myun;
myun.s = 0x0102;
if(sizeof(short) == 2){
if(myun.c[0] == 1 && myun.c[1] == 2)
printf("big-endian\r\n");
else if(myun.c[0] == 2 && myun.c[1] == 1)
printf("little-endian\r\n");
else
printf("unkown\r\n");
}
return 0;
}
摘自《Unix 网络编程》
相关文档:
动态获取IP
虚拟机的网卡使用NAT的连接方式(没办法,单位一个端口只允许1个IP,连hub都没法用)
pwd> vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO的值改为dhcp,并保存
ifdown eth0; ifup eth0;重启网卡
ifconfig 发现被分配了个IP:10.0.2.15
ping www.163.com 通过
静态设置IP
待续.... ......
administer@administer-laptop:~/tem/tt$ cat hello.asm
[section .data]
strHello db "Hello, world!",0Ah
STRLEN equ $-strHello
[section .text]
global _start
_start:
mov edx,STRLEN
mov ecx,strHello
mov ebx,1
mov eax,4
int 0x80
mov  ......
1, 下载 VMWare Player
http://www.vmware.com/products/player/
简
单注册一下,就可以下载了。
2, 生成 VMWare 的种子文件
http://www.easyvmx.com/new-easyvmx.shtml
3,
下载 你想要的Linux 的 ISO 文件。
4, 解压缩 2 中的 VMWare种子文件, 双击其中的
扩展名为vmx的文件。 然后在VMWarePlayer 中 设置 ......
学习Linux终端命令
linux目录架构
/ 根目录
/bin 常用的命令 binary file 的目錄
/boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
/boot/grub/menu.lst GRUB设置
/boot/vmlinuz & ......