Binary string to integer and integer to binary string
It makes sense for the two functions to be symmetrical - ie that you can call
them in turn to swap between integer and string representations.  So I would
make binstr2int produce an unsigned long of full range returned through a
parameter and have the function return the status (0/-1):

int binstr2int(const char *s, unsigned long &amp;num);


Note that s can be const.

In int2binstr I think the characters should be moved to the beginning of the
string - this is what all other C string functions do (or at least I'm
ignorant of any that do not).  Also, your code is a bit awkward in
that it treats 0 separately from all other numbers.  This is a case where a
do {...} while loop makes sense as it can handle the zero case as any other
number and test for zero once it has done it:

char* int2binstr(unsigned long num, char *s, size_t size)
{
    long len = (long) size - 1;
    do {
        if (len &lt;= 0) {
            errno = ERANGE;
            return NULL;
        }
        s[--len] = (num &amp; 1) ? '1' : '0';
    } while ((num &gt;&gt;= 1) != 0);

    long n = (long) size - len - 1;
    memmove(s, s + len, n);
    s[n] = '\0';
    return s;
}


Here you can see that the tests for a short input string and for 
num == 0 are handled naturally.  Also I moved the string into place after
creating it.