Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: Sandbox.c
- * Author: Rito
- *
- * Created on 24 de mayo de 2022, 12:34
- */
- #include <xc.h>
- #include <string.h>
- #include <stdio.h>
- #include <math.h>
- unsigned char bufferRX[50];
- unsigned char bufferTX[50];
- unsigned char data[50];
- unsigned char host[50];
- char dispositivo[3];
- char genero[3];
- int age;
- char edo_civil[3];
- char hijos[3];
- char religion [3];
- char educacion[3];
- char toma[3];
- char fuma[3];
- char ocupacion[3];
- char caracter[3];
- char casa[3];
- char carro[3];
- char comportamiento[3];
- char dispositivo_h[3];
- char genero_h[3];
- int age_h;
- char edo_civil_h[3];
- char hijos_h[3];
- char religion_h [3];
- char educacion_h[3];
- char toma_h[3];
- char fuma_h[3];
- char ocupacion_h[3];
- char caracter_h[3];
- char casa_h[3];
- char carro_h[3];
- char comportamiento_h[3];
- void main(void) {
- sprintf((char*)bufferTX,"45,65,43,69,6B,6F,75,7F,81,83,8B,8E,90,96");
- sprintf((char*)bufferRX,"29 66 42 67 6C 6F 9B 7F 81 82 88 9B 9B 92");
- strcpy (data, bufferTX);
- strcpy(host, bufferRX);
- char d[3]={0x20,0xD,NULL,","};
- char *datap0 = strtok(data,d);
- strcpy(dispositivo ,datap0); // add the gender
- *datap0=strtok(NULL,d);
- strcpy(genero,*datap0); // add the gender
- *datap0=strtok(NULL,d);
- age= atoi(datap0); //add the age and converted into integer
- *datap0=strtok(NULL,d);
- strcpy(edo_civil,datap0);//if married or not
- *datap0=strtok(NULL,d);
- strcpy(hijos,datap0);//if any kids
- *datap0=strtok(NULL,d);
- strcpy(religion,datap0); // religion
- *datap0=strtok(NULL,d);
- strcpy(educacion ,datap0);//education
- *datap0=strtok(NULL,d);
- strcpy(toma ,datap0);//drinks
- *datap0=strtok(NULL,d);
- strcpy(fuma ,datap0);//smokes
- *datap0=strtok(NULL,d);
- strcpy(ocupacion ,datap0); //occupation
- *datap0=strtok(NULL,d);
- strcpy(caracter ,datap0);//character
- *datap0=strtok(NULL,d);
- strcpy(casa ,datap0);//house
- *datap0=strtok(NULL,d);
- strcpy(carro ,datap0);//car
- *datap0=strtok(NULL,d);
- strcpy(comportamiento,datap0);
- *datap0=strtok(NULL,d);
- //en el host
- *datap0 = strtok(host,d);
- strcpy(dispositivo_h,datap0);//add the device into the string
- *datap0=strtok(NULL,d);
- strcpy(genero_h,datap0); // add the gender
- *datap0=strtok(NULL,d);
- age_h= atoi(datap0); //add the age and converted into integer
- *datap0=strtok(NULL,d);
- strcpy(edo_civil_h,datap0);//if married or not
- *datap0=strtok(NULL,d);
- strcpy(hijos_h,datap0);//if any kids
- *datap0=strtok(NULL,d);
- strcpy(religion_h,datap0); // religion
- *datap0=strtok(NULL,d);
- strcpy(educacion_h ,datap0);//education
- *datap0=strtok(NULL,d);
- strcpy(toma_h ,datap0);//drinks
- *datap0=strtok(NULL,d);
- strcpy(fuma_h ,datap0);//smokes
- *datap0=strtok(NULL,d);
- strcpy(ocupacion_h ,datap0); //occupation
- *datap0=strtok(NULL,d);
- strcpy(caracter_h ,datap0);//character
- *datap0=strtok(NULL,d);
- strcpy(casa_h ,datap0);//house
- *datap0=strtok(NULL,d);
- strcpy(carro_h ,datap0);//car
- *datap0=strtok(NULL,d);
- strcpy(comportamiento_h,datap0);
- *datap0=strtok(NULL,d);
- }
Add Comment
Please, Sign In to add comment