CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    166

    how to read an octal number?

    Hello,

    Given an 8 bit octal value sent over a tcp/ip connection how can I read it and display the value?

    Regards,
    E. Khule

  2. #2
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401

    Re: how to read an octal number?

    Read it into an unsigned char, then cast it to an unsigned int for output.
    More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf

    Premature optimization is the root of all evil --Donald E. Knuth


    Please read Information on posting before posting, especially the info on using [code] tags.

  3. #3
    Join Date
    Feb 2005
    Posts
    2,160

    Re: how to read an octal number?

    Is it being sent as a text representation of octal value? Try strtol() (or related functions) that take a radix argument.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured