Read the result of the hash by SHA-256 as a number I want to read the full output hash of SHA-256 as a number. How I can do it? Is it in the range of 0 to 2^256?
Yes, the output of SHA-256 is well distributed over the entire output of the hash function. That also means that any number generated by unknown input is well distributed, of course.

Which number is represented depends on the number system. If you want to interpret it to be in the range $\big[0, 2^{256}\big)$ then that's certainly possible - and the most likely interpretation by cryptographers (as most cryptographic algorithms use modular operations, and those are most easily defined to use zero- or positive integers).

To use SHA-256 as a positive number you simply interpret it as a statically sized, unsigned number.

Now the fact that it is statically sized doesn't matter much, as any library will likely skip leading zeros. It may however an issue if you want to revert back to bytes.

That leaves the issue of endianness of the number. You can interpret such a value as big endian (network order) number or little endian number. In case of big endian the most significant byte is on the left, while in little endian it is on the right. As the number is well distributed, each interpretation is equally valid - but obviously they will lead to different values with near-certainty for such large values. Generally cryptographers prefer big endian, especially for large number calculations as e.g. in RSA.

One way to do this for C++ is to use a cryptographic library, where such conversions are common. E.g. in Crypto++ there is the Integer constructor with a constructor using the following signature:


Integer::Integer  (   const byte *    encodedInteger,
                        size_t          byteCount,
                        Signedness      sign = UNSIGNED,
                        ByteOrder       order = BIG_ENDIAN_ORDER 
                    )       



Here encodedInteger would be the hash value of 32 bytes, byteCount would then be set to 32 of course. sign already defaults to unsigned as this is about cryptography and byte order has the right default as well. Beware that not every "BigNum" implementation will have such cryptographically sensible defaults - Java's BigInteger for instance does require you to explicitly indicate that the result should be interpreted as unsigned value.

In the RSA standard the operation is known as the Octet String to Integer Primitive (OS2IP). Please do note though that the formula for that method mathematically describes the usual layout of the bytes in memory. There is no need to perform any exponentiation or multiplication to implement such functionality.