I'm trying to convert a string into int32 in C++. In Python, I used to do:
import numpy as np
str = "HELLO"
np.array([str]).view(np.int32)
This results in:
array([72, 69, 76, 76, 79], dtype=int32)
i.e., the ord
of each char.
How can I achieve the same in C++?
P. S. I'm not looking for Numpy-style way to accomplish this. But, looking for possible ways to obtain the same results.