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

  • Home
  • SEARCH
  • 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 536067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:46:58+00:00 2026-05-13T09:46:58+00:00

I am basically trying to get a user to input a hexadecimal input via

  • 0

I am basically trying to get a user to input a hexadecimal input via
getline into a string as i will do other operations on this. (using c++ .net stuff won’t work)

i do not want to break this into chars per say and then go through each char in the string and see if its in range from [0-9] or [Aa-Ff].

Instead, I wanted to know if there was a cool function that anyone knew of or a better way to do it. I am aware of the strtoul function but it returns a long. this will force me to then i guess pass it to a stream to make it back into a string again.

another thing with the long i am not sure of if i have to worry about 64 bit long vs 32 bit long. I am developing this on a linx box using an intel processor but it could be used on a unix box whose processor could be 64 bit i am not sure.

so i guess there are two questions here really. any help would be most welcome

could I get an answer on:
can you also comment on my second question about the long? even though i don’t have to worry about that now…if i save a variable in a long using a 32 bit system….would that change ( i imagine so the size of long should change on a 64 bit processor) what would this mean for the info saved in the variable? and second in order to avoid the whole little/big endian thing i saved it in a long thinking since its a register of sorts it would not be an issue with porting. was i wrong to think that?

thanks

  • 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-05-13T09:46:58+00:00Added an answer on May 13, 2026 at 9:46 am

    Checking each char is the only way it can be done, period.

    However, you may be interested in isxdigit(int character) which returns 0 if the character passed isn’t a valid hexadecimal character (note that x is not included as a valid character).

    You can test if it’s a hex string in a single line using algorithms, though it’s a bit ugly. If you’re using Boost, you can pretty it up a lot by using boost::bind.

    The headers required by this snippet are <locale>, <functional>, and <algorithm>.

    bool is_hex_string(std::string& str) {
      return std::count_if(str.begin(), str.end(), 
        std::not1(std::ptr_fun((int(*)(int))std::isxdigit))) > 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 356k
  • Answers 356k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try $('tr td:last-child').each(function(){ var $this = $(this); alert('123'); }); May 14, 2026 at 8:52 am
  • Editorial Team
    Editorial Team added an answer Try to look at http://www.bouncycastle.org/csharp/ It's an open source project… May 14, 2026 at 8:52 am
  • Editorial Team
    Editorial Team added an answer Simplification of boilerplate SQL binding This isn't so much a… May 14, 2026 at 8:52 am

Related Questions

Still having issues with this problem. Please help if you can. So I am
Preamble So, this question has already been answered, but as it was my first
Well I am working on a site that basically accepts PayPal payments to give
I am new to Jquery and am trying to store the location and size
I am a noob Perl user trying to get my work done ASAP so

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.