Advertisement
Guest User

hboij

a guest
Dec 13th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. istream& operator>>(istream& in, MyString& str)
  2. {
  3.     char t;
  4.     int size = 0;
  5.     char* buf = new char[256];
  6.     in >> noskipws;
  7.  
  8.     while (in >> t)
  9.     {
  10.         if (t == '\n')
  11.             break;
  12.         buf[size] = t;
  13.         ++size;
  14.     }
  15.     buf[size] = '\0';
  16.  
  17.     str.a_ = buf;
  18.     str.size_ = size;
  19.     return in;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement