public static byte[] OS2IP (byte[] x)
{
int i = 0; while ((x [i++] == 0x00) && (i < x.Length))
{
// confuse compiler into reporting a warning with {}
} i--; if (i > 0)
{
byte[] result = new byte [x.Length - i];
Buffer.BlockCopy (x, i, result, 0, result.Length);
return result;
}
else
return x;
}
用 VC6编写,实在时间来不及。200分先答先给分. 再开贴给100
{
int i = 0; while ((x [i++] == 0x00) && (i < x.Length))
{
// confuse compiler into reporting a warning with {}
} i--; if (i > 0)
{
byte[] result = new byte [x.Length - i];
Buffer.BlockCopy (x, i, result, 0, result.Length);
return result;
}
else
return x;
}
用 VC6编写,实在时间来不及。200分先答先给分. 再开贴给100
解决方案 »
- listcontrol上设置edit的问题
- Create创建的静态文本的消息处理
- 如何找其他程序的窗口
- 怎样调试?!谢谢!
- 关于ADO+vc6.00+sqlserver2000中的一个小问题
- 在DLL中调用对话框的问题,请教高手
- 单独一个 CopyFile怎么拷贝不了文件?
- VC下关于debug和release的不同的讨论
- 请问如何在基于对话框的工程中添加SetTimer函数,最后添加WM_TIMER消息进行相应?
- 如何监控一个网页(比如http://www.some.com/one.php)是否产生变化?分不是问题!
- 请问如何获得用户电脑上操作系统的安装路径,即“WINDOWS”文件夹的所在路径??
- 请教 应用Speech SDK开发DLL
{
int i = 0;
while ((x[i++] == 0x00) && (i <nLen))
{
// confuse compiler into reporting a warning with {}
}
i--; if (i > 0)
{
BYTE* pResult = new BYTE[nLen-i];
memcpy(pResult, x+i, nLen);
return pResult;
}
else
return x;
}
my $string = shift;
my $base = PARI(256);
my $result = 0;
my $l = length($string);
for (0 .. $l-1) {
my ($c) = unpack "x$_ a", $string;
my $a = int(ord($c));
my $val = int($l-$_-1);
$result += $a * ($base**$val);
}
return $result;
}看来C#地实现达不到我的目的。
不过仍然200分给出。
class MyByte {
private:
BYTE * M_pByte;
LONG m_lLength ;
MyByte* pThis ;
public:
Length(){ return m_lLength ;}
BYTE operator[]( int i) { return m_pByte[i] }
MyByte& operator new (int size) { m_pByte = new BYTE[size/sizeof(MyByte)];
return m_pThis =allocate(sizeof(MyByte));
}
MyByte& operator delete[](){...} MyByte(){...}
}
MyByte* p = new MyByte[100];// equal BYTE m_pByte = new Byte[100];