为什么我听到这个程序发出哔哔声?

时间:2013-07-05 23:47:48

标签: c++

我在阅读时在源上看到了这个char szPrivateKey[]定义,所以我去看看它是什么,奇怪的是这在程序运行时发出声音。这里还有什么复活节彩蛋吗? (使用visual studio 2003 / windows编译)

int _tmain(int argc, _TCHAR* argv[])
{
    const unsigned char szPrivateKey[] = {
    0x30 ,0x82 ,0x04 ,0xBB ,0x02 ,0x01 ,0x00 ,0x30 ,0x0D ,0x06 ,0x09 ,0x2A ,0x86 ,0x48 ,0x86 ,0xF7 ,
    0x0D ,0x01 ,0x01 ,0x01 ,0x05 ,0x00 ,0x04 ,0x82 ,0x04 ,0xA5 ,0x30 ,0x82 ,0x04 ,0xA1 ,0x02 ,0x01 ,
    0x00 ,0x02 ,0x82 ,0x01 ,0x01 ,0x00 ,0x87 ,0x1F ,0xEC ,0xFD ,0xAF ,0xD2 ,0x2F ,0xAA ,0x4E ,0xC2 ,
    0xAD ,0x5A ,0x4C ,0x3A ,0x7A ,0x81 ,0x9E ,0xBA ,0x28 ,0x6A ,0x84 ,0xE9 ,0xB7 ,0xF9 ,0x36 ,0x87 ,
    0x56 ,0x16 ,0xC5 ,0xA4 ,0x1D ,0x11 ,0x67 ,0x12 ,0x87 ,0x81 ,0xF5 ,0xFA ,0xF6 ,0x01 ,0xE7 ,0x55 ,
    0x83 ,0x4A ,0xAC ,0x40 ,0x4D ,0x2C ,0x90 ,0x62 ,0x77 ,0xFC ,0x73 ,0xF9 ,0x5E ,0x7F ,0x67 ,0x8C ,
    0xA7 ,0x94 ,0x32 ,0x28 ,0xDD ,0xEF ,0x91 ,0xE5 ,0x94 ,0xD6 ,0x5C ,0xB5 ,0x63 ,0xC4 ,0x76 ,0x2D ,
    0xFF ,0x03 ,0x75 ,0x55 ,0x85 ,0x60 ,0x56 ,0x44 ,0x37 ,0x18 ,0x08 ,0xE7 ,0x0A ,0x90 ,0x74 ,0xA0 ,
    0x9E ,0x82 ,0x4F ,0x56 ,0x4C ,0xD9 ,0xE5 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0xC6 ,0x85 ,
    0x92 ,0x88 ,0xAC ,0xC8 ,0xAC ,0x9F ,0x18 ,0x74 ,0x9D ,0x45 ,0xB4 ,0x7B ,0x13 ,0xAB ,0x78 ,0x8D ,
    0x8B ,0xB5 ,0x9E ,0x9E ,0xD2 ,0xD7 ,0xF2 ,0x84 ,0x34 ,0xFB ,0x08 ,0xB2 ,0x23 ,0xC7 ,0x0B ,0xF0 ,
    0xA9 ,0xCA ,0x17 ,0x1A ,0xA2 ,0x6D ,0x63 ,0xD3 ,0x90 ,0xEF ,0xD1 ,0x62 ,0xE6 ,0x46 ,0x25 ,0x6D ,
    0x6D ,0x23 ,0x3B ,0xB0 ,0x65 ,0xEA ,0xE2 ,0x22 ,0x24 ,0xC9 ,0x09 ,0x1B ,0x0D ,0x42 ,0x9D ,0x77 ,
    0xE1 ,0x63 ,0xB2 ,0x03 ,0x0D ,0x4A ,0xA2 ,0xFD ,0x2E ,0x2D ,0xCD ,0x4B ,0x9E ,0x63 ,0x91 ,0x0F ,
    0x42 ,0xC2 ,0x01 ,0x24 ,0x68 ,0x4C ,0xB5 ,0xA8 ,0x35 ,0xE3 ,0x31 ,0xE8 ,0x86 ,0x32 ,0xB1 ,0xA9 ,
    0x4F ,0xBE ,0x23 ,0x3A ,0x3C ,0x0A ,0x5D ,0x26 ,0xBE ,0xA7 ,0x5D ,0xC0 ,0x60 ,0x42 ,0x1D ,};


    for( int i =0; i<sizeof(szPrivateKey); i++ )
    {
        cout << szPrivateKey[i] << endl;
    }


    return 0;
}

4 个答案:

答案 0 :(得分:20)

字符0x07是ASCII铃声字符。支持各不相同,但将其发送到控制台通常会产生一声嘟嘟声。

答案 1 :(得分:14)

因为在szPrivateKey - 0x07或CTRL-G中有一个0x07(在以0xBA开头的行中),在大多数系统上,将是一个BEL字符,所以它响铃在一个旧的电传打字机上。现代计算机,甚至是30年历史的终端,都没有机械铃(如果你现在能找到一个,也不会打字机),所以他们会用嘟嘟声。

在C和C ++中,你可以在"\a"的字符串中创建一个BEL字符(并且它也可以在不使用ASCII的系统上正常工作,它将生成任何相应的字符在非ASCII系统)。

顺便说一句,这不是一个“复活节彩蛋”,它是打印不是真正“文本”的东西的结果,因此不应该与cout一起显示。您可以使用type myfile.dat或类似的内容(假设myfile.dat是二进制文件并且其中包含0x07字节)。

答案 2 :(得分:8)

这是ascii表的前10个条目:

   Oct   Dec   Hex   Char                        
   ---------------------------------------------
   000   0     00    NUL '\0'                
   001   1     01    SOH (start of heading)  
   002   2     02    STX (start of text)     
   003   3     03    ETX (end of text)       
   004   4     04    EOT (end of transmission)
   005   5     05    ENQ (enquiry)           
   006   6     06    ACK (acknowledge)       
   007   7     07    BEL '\a' (bell)         
   010   8     08    BS  '\b' (backspace)    
   011   9     09    HT  '\t' (horizontal tab)

注意ascii代码7,如果你写了那个字符,很多终端都会发出声音。

答案 3 :(得分:4)

\a,也称为BEL,在大多数机器中都有0x07的线索。

来自C ++ 11 2.14.3

  

警告BEL \ a

来自C99 5.2.2

  

\ a(警报)在不更改活动位置的情况下生成声音或可见警报。