1

I am not using this anywhere, while working with other programs I got a doubt. How to pass a binary number as command line parameter and what functions are available to convert to integer?

Example:

./HelloWorld b1010

above code I want to read as integer 10. Any suggestions ?

1 Answer 1

3

Use strtol with a base of 2. Remove/check the b character first.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.