I have a string of binary that I then convert to an integer using atoi(). When I do this it seems to automatically convert the binary to decimal. The issue is that
atoi()
It sounds like you should be using strtol() with 2 as the last argument.
2