I want to know on C language or C++, if I can know within a function if the real parameter of a formal pointer input/output parameter, let's say to a byte array or char array, has been passed using an array of defined size (static pointer) or a pointer created with calloc (dynamic pointer) from the caller. The formal parameter could have been defined as an array or as a pointer.
I need to know that because in the second case I could reallocate the memory to return, on this same parameter, a bigger size string compared to the original allocated space.
I have to do this because I am converting an existing library on C# to C, and at first it has to be exactly as the original, so dont scold at me.
I apologize because I dont know the right names for what I called the types of real parameters and someone can be confused but I don know.
Example >
void FunctionName( char sCadenaHexa[], int SizeOfCadena )
{
... How I know how was called ....
}
Called using "array defined size" or "static pointer" :
char sRealCadena[100] = "something";
FunctionName( sRealCadena, 100 );
Called using a pointer or "dynamic pointer" :
char *sRealCadena = malloc( 100, sizeof(char) );
FunctionName( sRealCadena, 100 );
Of course I will try to redesign the function adding another parameter as the output string paremeter, but as first approach I have to stick to the current design.
If the thread is repeated Im sorry, but I didnt find it.
Thanx in advance