#include <stdio.h> #include <string.h> int main(int argv,char *argv[]) { char Buffer[128]; char *Data; Buffer = "the cat sat on the mat"; Data = &Buffer[5]; Buffer = Data; strcpy(Data,Buffer); return(0); }
#include <stdio.h> #include <string.h> int main(int argc,char *argv) { char Buffer[128],Data[128]; char *Offset; strcpy(Buffer,"What excellent stuffing"); Offset = strtok(Buffer," "); printf("%s\n",Buffer); Offset = strtok(NULL," "); strcpy(Data,Offset); printf("%s\n",Data+3); Offset = strtok(NULL," "); printf("%s\n",Offset); strncpy(Data,&Offset[3],3); printf("%s\n",Data); return(0); }