Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
Split.c
00001 /* 00002 * Split.c 00003 * 00004 * Created on: 12/04/2012 00005 * Author: francisco 00006 */ 00007 00008 #include "Split.h" 00009 00010 int split(char* str,char* delim,char*** ret ) 00011 { 00012 char *p = NULL; 00013 char *e = NULL; 00014 char **array = NULL; 00015 int qty = 0; 00016 int len = strlen(str); 00017 00018 p = str; 00019 00020 e = strstr(p,delim); 00021 00022 while( e != NULL) 00023 { 00024 qty++; 00025 if(qty==1) 00026 array = (char**)malloc(sizeof(char*)*qty); 00027 else 00028 array = (char**)realloc(array,sizeof(char*)*qty); 00029 00030 array[qty-1] = p; 00031 *e = '\0'; 00032 p = e + strlen(delim); 00033 e = strstr(p,delim); 00034 } 00035 if(p-str < len) 00036 { 00037 qty++; 00038 if(qty==1) 00039 array = (char**)malloc(sizeof(char*)*qty); 00040 else 00041 array = (char**)realloc(array,sizeof(char*)*qty); 00042 array[qty-1] = p; 00043 } 00044 00045 *ret = array; 00046 return qty; 00047 }
Generated on Fri Jul 22 2022 19:25:55 by
