G
Gizmo
hi there i was trying to create memory for a char dynamicaly. However when
i do this it seens to create 4 extra spaces in the veriable for stuff to be
stored.
char *tempChar = (char*)malloc(strlen(cStringBeingLookedAt) );
that is what im doing but when i come to look at it in debug mode it shows
as "IIIIIIIIyyyy"
each I = a space for a char. However it sticks these 4 y's on the end.
This leaves me a 4 char space each time and i dont' want these. i tried to
do
char *tempChar = (char*)malloc(strlen(cStringBeingLookedAt) - 4);
but if my string that im alocating space for is less than 4 it comes up with
a memory error. Im trying to compare it with another script but i can't do
this while these extra y's are on the end.
Any help would be grate
Thanks Gizmo
i do this it seens to create 4 extra spaces in the veriable for stuff to be
stored.
char *tempChar = (char*)malloc(strlen(cStringBeingLookedAt) );
that is what im doing but when i come to look at it in debug mode it shows
as "IIIIIIIIyyyy"
each I = a space for a char. However it sticks these 4 y's on the end.
This leaves me a 4 char space each time and i dont' want these. i tried to
do
char *tempChar = (char*)malloc(strlen(cStringBeingLookedAt) - 4);
but if my string that im alocating space for is less than 4 it comes up with
a memory error. Im trying to compare it with another script but i can't do
this while these extra y's are on the end.
Any help would be grate
Thanks Gizmo