Re: General method for dynamically allocating memory for a string
- From: websnarf@xxxxxxxxx
- Date: 31 Aug 2006 09:53:26 -0700
websnarf@xxxxxxxxx wrote:
#include <stdlib.h>
#include <string.h>
char * substralloc (const char * src, size_t pos, size_t len) {
size_t i;
char * substr;
if (NULL == src || len < pos) return NULL; /* Bad parameters */
Whoops! That should just be if (NULL == src) return NULL;
--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/
.
- References:
- Prev by Date: Re: C IDE Recommendations
- Next by Date: Re: changing allocated memory
- Previous by thread: Re: General method for dynamically allocating memory for a string
- Next by thread: Re: General method for dynamically allocating memory for a string
- Index(es):