Last active
May 9, 2016 14:20
-
-
Save marcosdalte/38cfce4fa360e78dc681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main(){ | |
printf("%s.%d\n",__FUNCTION__,__LINE__); | |
char pkg_code[6] = {"20gb"}; | |
char unity[10]; | |
char volume[10]; | |
memset(unity,'\0',sizeof(unity)); | |
memset(volume,'\0',sizeof(volume)); | |
char *_unity = pkg_code+(strlen(pkg_code+2)); | |
printf("%s.%d:Unity:%s\n",__FUNCTION__,__LINE__,_unity); | |
int i, cont = 0; | |
for (i=0;*(pkg_code+i)!='\0';i++){ | |
if (isdigit(pkg_code[i])){ | |
printf("digit:%c\n",*(pkg_code+i)); | |
*(unity+cont) = *(pkg_code+i); | |
cont++; | |
} | |
} | |
*(unity+cont+1) = '\0'; | |
cont = 0; | |
for (i=0;*(pkg_code+i)!='\0';i++){ | |
if (isalpha(pkg_code[i])){ | |
printf("caract:%c\n",*(pkg_code+i)); | |
*(volume+cont) = *(pkg_code+i); | |
cont++; | |
} | |
} | |
*(volume+cont+1) = '\0'; | |
printf("%s.%d:!unity:%s\n",__FUNCTION__,__LINE__,unity); | |
printf("%s.%d:!volume:%s\n",__FUNCTION__,__LINE__,volume); | |
printf("%s.%d:!pkg_code:%s\n",__FUNCTION__,__LINE__,pkg_code); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment