本帖最后由 priceyao 于 2009-08-01 15:28:03 编辑

解决方案 »

  1.   

    UInt32 lengthOfApp1 = binReader.ReadUInt32();
                  lengthOfApp1 = (ushort)(lengthOfApp1   <  <16 | lengthOfApp1 >>16); 不行?
    Uint32就是4个字节的。
    4个字节的一半就是2个字节,16位啊
      

  2.   

    用Uint32读 并按你说的(lengthOfApp1   <  <16 | lengthOfApp1 >>16 改成16
    变量只得到了第3和第4个字节,我想读的是全部四个字节
      

  3.   


    的确是读了四个字节 但只付给变量两个字节
                UInt32 temp = binReader.ReadUInt32();
                temp = (ushort)(mthd << 16 | mthd >> 16);
                MessageBox.Show(Convert.ToString(temp,16));前四个字节是4d 54 68 64   现在megbox只显示  64 68
      

  4.   

    (ushort)是这个的问题。。
    去掉
      

  5.   

      static void Main(string[] args)
            {
               UInt32 temp = Convert.ToUInt32( Console.ReadLine());
               Console.WriteLine(Convert.ToString(temp, 16));
                temp = (temp << 16 | temp >> 16);
                Console.WriteLine( Convert.ToString(temp, 16));            
            }
    2222222
    21e88e
    e88e0021
    请按任意键继续. . .
      

  6.   

     static void Main(string[] args)
            {
                UInt32 temp = Convert.ToUInt32(Console.ReadLine());
                Console.WriteLine(Convert.ToString(temp, 16));
                UInt16 U16d = (ushort)temp, U16g = (ushort)(temp >> 16);
                Console.WriteLine("{0} {1}", Convert.ToString(U16g, 16), Convert.ToString(U16d, 16));
                U16g = (ushort)(U16g << 8 | U16g >> 8);
                U16d = (ushort)(U16d << 8 | U16d >> 8);
                temp = (UInt32)(U16g << 16 | U16d);
                Console.WriteLine(Convert.ToString(temp, 16));
            }一次读32位