Skip to content

Instantly share code, notes, and snippets.

@bullheadandplato
Created November 16, 2020 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bullheadandplato/d39666ff6c4faabf53ee2490cf5a8526 to your computer and use it in GitHub Desktop.
Save bullheadandplato/d39666ff6c4faabf53ee2490cf5a8526 to your computer and use it in GitHub Desktop.
#include<stdlib.h>
#include<strings.h>
#include<stdio.h>
int main(){
char *sRaw="02010606FFCDAB641001565";
printf("All [%s]\n",sRaw);
char *till18=malloc(18);
strncpy(till18,sRaw,18);
printf("till18 [%s]\n",till18);
int lenTill18=strlen(till18);
char *just18=&till18[lenTill18-1];
printf("just18 [%s]\n",just18);
char *till17=malloc(17);
strncpy(till17,sRaw,17);
printf("till17 [%s]\n",till17);
int lenTill17=strlen(till17);
char *just17=&till17[lenTill17-1];
printf("just17 [%s]\n",just17);
return 0;
}
@bullheadandplato
Copy link
Author

Screen Shot 2020-11-16 at 14 34 03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment