To make up a packet in python, with this format:
1 Byte (seq)+ 1 Byte (length) + N Bytes data (data, n<255),
then it will be easy to just:
newdata = chr(seq)+chr(len(data)+data
then data will be just a sequence of chars.
Thursday, December 07, 2006
In order to convert char into int in C / C++, there are two methods,
1. to convert a string '1234' into integer 1234:
void main (void)
{
char c[4];
int i;
strcpy(c,"1234");
i = atoi(c);
}
2. to conver an ascii character 'q' into its decimal representation: 113
{
char c;
int i;
c='q';
i=(int)c;
}
then i will be 113.
1. to convert a string '1234' into integer 1234:
void main (void)
{
char c[4];
int i;
strcpy(c,"1234");
i = atoi(c);
}
2. to conver an ascii character 'q' into its decimal representation: 113
{
char c;
int i;
c='q';
i=(int)c;
}
then i will be 113.
Thursday, September 21, 2006
Friday, September 15, 2006
这两天在尝试通过boot camp往macbook上装windows,结果失败了: hal.dll missing....
后来发现,问题在于我在安装windows的时候,把boot camp分出来的驱拆除了,然后再重新分了一次。这就出现问题了。
boot camp分区的方法是:200mb free space紧跟os x 分区。而windows分区是windows partition紧跟os x partition.....呵呵。 that is the tricky part...
解决方法:
利用os x 安装盘进入硬盘上面的os x,然后用boot camp把windows分区拆除了再分一次。然后重头开始。
后来发现,问题在于我在安装windows的时候,把boot camp分出来的驱拆除了,然后再重新分了一次。这就出现问题了。
boot camp分区的方法是:200mb free space紧跟os x 分区。而windows分区是windows partition紧跟os x partition.....呵呵。 that is the tricky part...
解决方法:
利用os x 安装盘进入硬盘上面的os x,然后用boot camp把windows分区拆除了再分一次。然后重头开始。
Monday, September 11, 2006
Saturday, September 09, 2006
Subscribe to:
Posts (Atom)



