title: Qt. Copy resource file in QProcess
body: <p>I'm trying to copy a file I have attached to my program like resource in a <code>/usr/share/postgresql/10/extension/</code> (needs <code>sudo</code> rights)</p>
  
  <p>If the destination path was in <code>/home</code> I could do something like that:</p>
  
  <pre><code>QFile file(QStringLiteral(":/resourcefile"));
  if(file.open(QIODevice::ReadOnly))
  {
      file.copy("/home/user/......./resourcefile");
  }
  </code></pre>
  
  <p>But it's not my case. Therefore I must to use QProcess (I think) in <a href="https://stackoverflow.com/questions/23322739/how-to-execute-complex-linux-commands-in-qt">this way</a>:</p>
  
  <pre><code>QProcess process1, process2;
  
  process1.setStandardOutputProcess(&amp;process2);
  process1.start("echo mypass");
  process2.start("sudo -S cp &lt;resourcefile&gt; /usr/share/postgresql/10/extension/file.sql");
  process2.setProcessChannelMode(QProcess::ForwardedChannels);
  bool retval = false;
  QByteArray buffer;
  while ((retval = process2.waitForFinished()));
      buffer.append(process2.readAll());
  .....
  </code></pre>
  
  <p>And the question is....how could I pass the <code>&lt;resourcefile&gt;</code> to process2?</p>