Subj : Re: malloc and free To : borland.public.cpp.borlandcpp From : Ed Mulroy [TeamB] Date : Sun Jul 11 2004 10:12 pm Note that _msize is not standard C or C++ and is only in the later versions of BC++. There is no standard way to find out later what the allocated size of the memory whose address a pointer contains. .. Ed > Alistair wrote in message > news:40f1ad85$1@newsgroups.borland.com... > _msize(void *pointer); > > Never mind! Why is it I look for ages and cant find a thing, then soon as I > post a question I find the answer! > > > char * memused = (char *)malloc(80); //allocate 80 bytes > > memset(memused, '\0', 80); > > strcpy(memused, "TEST"); > > > > How do i find out how many bytes memused has if I dont > > remember the value 80? > > strlen returns 4, which is correct, but I want the amount of > > memory allocated in the first place. > > > > Does anyone know?! .