<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[In Regsitry schreiben mit Variablen]]></title><description><![CDATA[<p>hi,</p>
<p>also ich habe Folgenes Problem:</p>
<p>ich möchte in die registry schreieb naber das nicht direkt sonder der pfard soll in variablen gespeichert sein:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;

using namespace std;

int main(int argc, char *argv[])
{
string x =&quot;Pf1&quot;;
string y =&quot;Pf2&quot;;
string z =&quot;Pf3&quot;;

  HKEY hKey;
  RegCreateKeyEx(HKEY_LOCAL_MACHINE,&quot;Testen&quot;,0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&amp;hKey,0);
  RegDeleteValue(hKey,x);
  RegDeleteValue(hKey,y);
  RegDeleteValue(hKey,z);

  DWORD dwNumber=1;
RegSetValueEx(hKey,x,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
RegSetValueEx(hKey,y,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
RegSetValueEx(hKey,z,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
  RegCloseKey(hKey);
  return 0;
}
</code></pre>
<p>leider kommen hierbei immer fehler :</p>
<p>cannot convert `y' from type `string' to type `const CHAR *'</p>
<p>wie kann ich das Problem lösen?</p>
<p>mfg</p>
<p>der kleine sucher</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/162653/in-regsitry-schreiben-mit-variablen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 17 Jul 2026 21:53:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/162653.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 21 Oct 2006 10:59:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to In Regsitry schreiben mit Variablen on Sat, 21 Oct 2006 10:59:25 GMT]]></title><description><![CDATA[<p>hi,</p>
<p>also ich habe Folgenes Problem:</p>
<p>ich möchte in die registry schreieb naber das nicht direkt sonder der pfard soll in variablen gespeichert sein:</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;

using namespace std;

int main(int argc, char *argv[])
{
string x =&quot;Pf1&quot;;
string y =&quot;Pf2&quot;;
string z =&quot;Pf3&quot;;

  HKEY hKey;
  RegCreateKeyEx(HKEY_LOCAL_MACHINE,&quot;Testen&quot;,0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&amp;hKey,0);
  RegDeleteValue(hKey,x);
  RegDeleteValue(hKey,y);
  RegDeleteValue(hKey,z);

  DWORD dwNumber=1;
RegSetValueEx(hKey,x,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
RegSetValueEx(hKey,y,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
RegSetValueEx(hKey,z,0,REG_DWORD,(BYTE*)&amp;dwNumber,sizeof(DWORD));
  RegCloseKey(hKey);
  return 0;
}
</code></pre>
<p>leider kommen hierbei immer fehler :</p>
<p>cannot convert `y' from type `string' to type `const CHAR *'</p>
<p>wie kann ich das Problem lösen?</p>
<p>mfg</p>
<p>der kleine sucher</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1158617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158617</guid><dc:creator><![CDATA[Der kleine sucher]]></dc:creator><pubDate>Sat, 21 Oct 2006 10:59:25 GMT</pubDate></item><item><title><![CDATA[Reply to In Regsitry schreiben mit Variablen on Sat, 21 Oct 2006 11:40:01 GMT]]></title><description><![CDATA[<p>Mit x.c_str() usw... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1158644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158644</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sat, 21 Oct 2006 11:40:01 GMT</pubDate></item><item><title><![CDATA[Reply to In Regsitry schreiben mit Variablen on Sat, 21 Oct 2006 11:55:13 GMT]]></title><description><![CDATA[<p>wie bitte ? geht es auch vieleicht ein bisschen genauer ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1158650</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158650</guid><dc:creator><![CDATA[Der kleine sucher]]></dc:creator><pubDate>Sat, 21 Oct 2006 11:55:13 GMT</pubDate></item><item><title><![CDATA[Reply to In Regsitry schreiben mit Variablen on Sat, 21 Oct 2006 12:51:50 GMT]]></title><description><![CDATA[<p>Oha...</p>
<pre><code class="language-cpp">#include &lt;String&gt;
using namespace std;

string strBsp(&quot;This is a Demo-String!&quot;);
const char* pszPBsp = strBsp.c_str();
</code></pre>
<p>Kurz: Mit der Methode c_str() kannst du dein std::string-Objekt in einen C-String 'umwandeln'.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1158699</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158699</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sat, 21 Oct 2006 12:51:50 GMT</pubDate></item></channel></rss>