#include "string.h"#include "stdlib.h"#include "stdio.h"int main(){ char str[]="00:22:33:4B:55:5A"; char *delim = ":"; char * pch; printf ("Splitting string \"%s\" into tokens:\n",str); pch = strtok(str,delim); while (pch != NULL) { //int *a=malloc(strlen(pch)*sizeof(char))// int *a=strdup(pch) printf ("%s\n",pch); pch = strtok (NULL, delim); } system("pause"); return 0;}
沒有留言:
張貼留言