Mercurial > hg > Applications > Grep
view c/regexParser/word.c @ 116:66c633575b53 pairPro
remove error and warning
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Nov 2015 17:07:08 +0900 |
parents | ca30f8334741 |
children | 166136236891 |
line wrap: on
line source
#include <ctype.h> #include <string.h> #include <stdio.h> #include <stdlib.h> unsigned char* getWord(unsigned char *string) { int wordSize = 0; while (isalnum(string[wordSize])) { wordSize++; } int allocateWordSize = wordSize + 1; unsigned char *word = (unsigned char*)malloc(sizeof(unsigned char)*allocateWordSize); strncpy((char*)word, (char*)string, allocateWordSize); word[wordSize] = '\0'; return word; }