Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9243965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:55:20+00:00 2026-06-18T08:55:20+00:00

I have following program. Oddly, i expect zero, but the program thinks it is

  • 0

I have following program. Oddly, i expect zero, but the program thinks it is 48. If i debug this program, i can see the value assigned as 48, but if i print the value of “someVar”, it displays correctly as 0. But if i convert “someVar” to uint16_t, then everything works fine. Can you please explain the issue

#include "boost/cstdint.hpp"
#include <iostream>
#include "boost/lexical_cast.hpp"

using namespace boost;
int main(int argc, char ** args)
{
  uint8_t someVar = lexical_cast<uint8_t> (args[1]);
  if (someVar > 0)
    cout << "greater than zero" << endl;

  return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:55:20+00:00Added an answer on June 18, 2026 at 8:55 am

    The character zero ('0' is indeed 48, where the number zero as an integer, obviously indeed IS zero). If you make a lexical_cast<int>, it will do what you want, and convert the args[1] into an integer number from the string. Since uint8_t is a character, I suspect lexical cast does what you ask for, and give you the first character of the string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following program but for some reason it is throwing an error
I have the following program written in C++: The problem with this program is
I have the following program: def main(): print Running primes = sieve(100000) print Sieve
i have the following program which goes to database and gets the value, i
I have the following scenario: Program P (can take upto 30 minutes to complete)
I have this following program which gets the number of files from user, then
I have the following program but it wrongly displays the month. please help. date1=31/12/2011;
Suppose I have the following program: #include <stdio.h> int main() { printf(This is a
I have the following program. However, I can't understand why I have to pass
I have the following program in C++: There are two problems with this program.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.