Advertisement
thenuke321

Untitled

Feb 23rd, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. char toChar(string data)
  2. {
  3.     // Data
  4.     const int theSize = data.size();
  5.     char *pd = new char[data.size() + 80];
  6.     strcpy(pd, data.c_str());
  7.     //delete [] pd;
  8.     return *pd;
  9. }
  10.  
  11.  
  12. int main ()
  13. {
  14.     string input;
  15.     getline(cin,input);
  16.     //int theSize(input.size());
  17.     int theSize(sizeof(input)+2);
  18.    
  19.     cout << theSize << endl;
  20.     char *theBox = new char[theSize];
  21.     string *tbin = new string;
  22.     while(theSize != 0)
  23.     {
  24.  
  25.         memcpy(tbin,input.c_str(),theSize);
  26.         theBox[theSize] = toChar(*tbin);
  27.         *tbin = "";
  28.         theSize = theSize - 1;
  29.     }
  30.    
  31.     getline(cin,input);
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement