Subj : Re: malloc and free To : borland.public.cpp.borlandcpp From : Jan Vernimmen Date : Tue Jul 13 2004 03:32 pm Hallo, Is not the best thing you can do make an include file with all your constant values (also CM_xxx and WM_xxx) for this project, something like in this case: .. .. #define LEN_MEMUSED 80 .. .. char * memused = (char *)malloc(LEN_MEMUSED); //allocate 80 bytes memset(memused, '\0', LEN_MEMUSED ); .. .. and so on Greetings, Jan Alistair wrote: > 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?! > > Cheers > > Alistair > > .