title: SIGSEGV when trying to change string in structure C/C++
body: <p>I have a structure like this </p>
  
  <pre><code>    typedef struct {
      string aPath;
      string dPath;
      string tmpPath;
      int cSet;
      int socket;
      } threadParams;
  </code></pre>
  
  <p>And some variables like this</p>
  
  <pre><code>string dirPath = "./Maildir/";
  string authPath;
  string tmpPath = "~/tmpPath/";
  </code></pre>
  
  <p>Im trying to initialize structure and add some data like this</p>
  
  <pre><code>            threadParams *tP = (threadParams*)malloc(sizeof(threadParams));
              tP-&gt;aPath = authPath;
              tP-&gt;cSet = cParam;
              tP-&gt;dPath = dirPath;
              tP-&gt;socket = commSocket;
              tP-&gt;tmpPath = tmpPath;
  </code></pre>
  
  <p>When I run program with this code there is SIGSEGV signal while trying to execute this: tP->aPath = authPath; when i delete these string members of structure and keep just int variable its okay, everything works properly.</p>
  
  <p>Can anyone tell me why is this happening and how to fix it? Thank you</p>