In C language, after the struct pointer is passed into the function, the memory address remains unchanged and the memory data changes:
Rgbblockinfo_t * rgbblockinfo = NULL;
/* Obtain the address */
Rgbblockinfo = filetorgbbufblock (rgbbufinfo, "d :\\ picdata \ pens. RGB ");
/* Pass the address to the function */
Rgbfilewrite (rgbblockinfo, "d: \ picdata \ pens2.rgb ");
After passing in the function, the memory address remains unchanged, but the data pointed to by the memory address changes.
Before import:
After passing in:
So, as a cainiao, I am wondering where to modify the memory value?
I have studied it today. In the filetorgbbufblock function, the local variable rgbblockinfo_t rgbbuf is defined, and the address of the local variable is returned through return.
The problem occurs here because rgbbuf is a local variable and will be released after the function is called. Therefore, the value in the memory will be released.