int main()
{
A tmp;
int *p_int, *p_float;
int a = 10; float b= 10.5;
p_int = &a; p_float = &b;
memcpy(tmp.m_pbuff, p_int, sizeof(int));
tmp.m_pbuff = m_pbuff + 4;
memcpy(tmp.m_pbuff, p_float, sizeof(float));
tmp.m_pbuff = m_pbuff + 4;
-> And then i wanna read all data in tmp.m_pbuff.
however, I think i have to convert it into proper data type.
I don't know how to do.
I need any help. thank you in advance.
}
What you are doing now is copying bytes from one place to another. The data types involved don't affect anything. I don't see what you are trying to achieve. While your title implies that you want to convert a string to an integer, you don't have a string. Is it the other way? In either case, Zhuge gave the right answer.