F
Frodo Baggins
Hi
I need to know the size of the memory block pointed to by a char* in a
function receiving this pointer. Typically, this pointer points to a
string. strlen() will not do the job since sometimes the string is not
null terminated.
That is:
int foo(void)
{
/* ...... */
char buf[20];
a(buf);
/* ....... */
return 0;
}
void a(char* ptr)
{
/* Here, I need the length of the mem block pointed at by ptr */
}
I need to know the size of the memory block pointed to by a char* in a
function receiving this pointer. Typically, this pointer points to a
string. strlen() will not do the job since sometimes the string is not
null terminated.
That is:
int foo(void)
{
/* ...... */
char buf[20];
a(buf);
/* ....... */
return 0;
}
void a(char* ptr)
{
/* Here, I need the length of the mem block pointed at by ptr */
}