| | |
Binary String in to Integer in c++
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
construct a bitset using the string and then convert it to a ulong.
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> #include <bitset> #include <limits> using namespace std ; int main() { string str = "00000100" ; cout << bitset<numeric_limits<unsigned long>::digits>(str).to_ulong() << '\n' ; }
![]() |
Similar Threads
- to convert string to integer value (Legacy and Other Languages)
- String to integer conversion (C)
- Convert a string to an integer (PHP)
- Converting String to Integer help (C++)
- String to integer to ascii (C)
Other Threads in the C++ Forum
- Previous Thread: Permutaions With Recursion
- Next Thread: How to fit integer in format......
Views: 5742 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






