Encoding dec char instead of octal -


i not understand why

char test = '\032'; 

converts to

26 dec 

'\032' seems interpreted octal, want treated decimal number.

i think confused character encoding.

can clarify me , give me hint on how convert way want it?

in c, '\octal-digit' begins octal-escape-sequence. there no decimal-escape-sequence.

code use:

  char test = 32; 

to assign value of 32 char, code has many options:

  // octal escape sequence   char test1 = '\040';  // \ , 1, 2 or 3 octal digits   char test2 = '\40';    // hexadecimal escape sequence   char test3 = '\x20'; // \x , 1 or more hexadecimal digits    // integer decimal constant   char test4 = 32;     // 1-9 , 0 or more decimal digits    // integer octal constant   char test5 = 040;     // 0 , 0 or more octal digits   char test6 = 0040;   char test7 = 00040;    // integer hexadecimal constant   char test8 = 0x20;   // 0x or 0x , 1 or more hexadecimal digits   char test9 = 0x20;    // universal-character-name   char testa = '\u0020';      // \u & 4 hex digits   char testb = '\u00000020';  // \u & 8 hex digits    // character constant   char testc = ' ';   // when character set ascii 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -