SHARE
TWEET

Tokenizer

LUV2XLR8 Apr 21st, 2018 (edited) 30 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. string chip, temp , accX, accY, accZ, gyro, magX, magY, magZ ;
  6. int main ()
  7. {  
  8.    
  9.     char (server_reply)[] = "Hallo,was,geht,das,ist,ein,test,fur,informatik,labor" ;
  10.    
  11.     char *ptr;
  12.    
  13.     //Chippbezeichnung
  14.     ptr = strtok (server_reply,",");
  15.     chip=ptr;
  16.     cout<<chip<<endl;
  17.    
  18.     //Temperatur
  19.     ptr = strtok(NULL,",");
  20.     temp=ptr;
  21.     cout<<temp<<endl;
  22.    
  23.     //BeschleunigungX
  24.     ptr = strtok(NULL,",");
  25.     accX=ptr;
  26.     cout<<accX<<endl;
  27.    
  28.     //BeschleunigungY
  29.     ptr = strtok(NULL,",");
  30.     accY=ptr;
  31.     cout<<accY<<endl;
  32.    
  33.     //BeschleunigungZ
  34.     ptr = strtok(NULL,",");
  35.     accZ=ptr;
  36.     cout<<accZ<<endl;
  37.    
  38.     //gyro
  39.     ptr = strtok(NULL,",");
  40.     gyro=ptr;
  41.     cout<<gyro<<endl;
  42.    
  43.     //magX
  44.     ptr = strtok(NULL,",");
  45.     magX=ptr;
  46.     cout<<magX<<endl;
  47.    
  48.     //magY
  49.     ptr = strtok(NULL,",");
  50.     magY=ptr;
  51.     cout<<magY<<endl;
  52.    
  53.     //magZ
  54.     ptr = strtok(NULL,",");
  55.     magZ=ptr;
  56.     cout<<magZ<<endl;
  57.    
  58.    
  59.    
  60.    
  61.    
  62.  
  63. return 0 ;
  64.  
  65. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top