This does NOT allocate enough space.


char* ptrB=malloc(sizeof(char*));


strlen() +1 should be enough.

Tim S.