Converting a binary input to long integers

Feb 12, 2013 at 11:42pm
A user has to input two numbers in binary
for example like this:
1
2
10001010101110100101101111100
10101010000010111110011111101

I could just save that in a char array, but I want to save some memory (because user can input a million digit long binary string) so I thought I could just break the whole string into several integer numbers
(ex. short int long...)

This will also save processing time of the function I want to do on those two but let's leave that aside.

So how can I convert STDIN to for example int array?
I mean, scanf and cin would have to copy the user input, char per char, into the char array anyway, why not recycle that?
Last edited on Feb 12, 2013 at 11:44pm
Topic archived. No new replies allowed.