CodePudding user response:
Byte to write their own operation cycleWrite a structure and structure assignment is used to implement
Are memcpy and no memcpy traversal
So the question to the
Why do you want to ask for it?
CodePudding user response:
QDataStream qt, but I guess it's internal memcpy is used to realize, but when users did not see the mem,CodePudding user response:
//binary stream containing the int type and char type, such as 0 and 1 is two char types, 2-5, 6-9 are two type int, 10-11 are two char types, in c + + and Qt, do not use the memcpy function
Char buf [12].
Char a, b;
Int c, d;
Char e, f;
A=buf [0].
B=buf [1].
C=(int) (
((unsigned int) buf [2]) & lt; <24 |
((unsigned int) buf [3]) & lt; <16 |
((unsigned int) buf [4]) & lt; <8 |
((unsigned int) buf [5])
);
D=(int) (
((unsigned int) buf [6]) & lt; <24 |
((unsigned int) buf [7]) & lt; <16 |
((unsigned int) buf [8]) & lt; <8 |
((unsigned int) buf [9])
);
E=buf [0].
F=buf [1].
C, d value if wrong, put the order of 2345 and 6789 (size)
CodePudding user response:
E=buf [10].F=buf [11];
CodePudding user response:
This is called formatting,Constructs a role is to give you a formatted,
Struct A
{
Char
Int
Int
Char
Char
}
A * pA=new A ();
PA=(A *) & amp; Buffer;
CodePudding user response: