<?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[GetPrivateProfileString nur erster Buchstabe]]></title><description><![CDATA[<pre><code>#include &quot;stdafx.h&quot;
#include &quot;iostream&quot;
#include &quot;conio.h&quot;
#include &quot;windows.h&quot;

int main()
{
	char Pfad[100];
	char Version[100];
	DWORD destSize;

	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\Files.ini&quot;),TEXT(&quot;C:\\Files.ini&quot;));
	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;1.00&quot;),TEXT(&quot;C:\\Files.ini&quot;));

	destSize=500;
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\KeineAhnung&quot;),LPWSTR(Pfad),destSize,TEXT(&quot;C:\\Files.ini&quot;));
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;NULL&quot;),LPWSTR(Version),destSize,TEXT(&quot;C:\\Files.ini&quot;)); 
	std::cout &lt;&lt; Version &lt;&lt; &quot;\n&quot;;
	std::cout &lt;&lt; Pfad &lt;&lt; &quot;\n&quot;;
	_getch();

}
</code></pre>
<p>Wenn ich meinen Code ausführe wird in der Konsole immer nur die ersten Buchstaben angezeigt also so:</p>
<pre><code>1
C
</code></pre>
<p>Was habe ich falsch gemacht?!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/214066/getprivateprofilestring-nur-erster-buchstabe</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 06:35:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/214066.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 May 2008 12:05:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 12:09:45 GMT]]></title><description><![CDATA[<pre><code>#include &quot;stdafx.h&quot;
#include &quot;iostream&quot;
#include &quot;conio.h&quot;
#include &quot;windows.h&quot;

int main()
{
	char Pfad[100];
	char Version[100];
	DWORD destSize;

	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\Files.ini&quot;),TEXT(&quot;C:\\Files.ini&quot;));
	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;1.00&quot;),TEXT(&quot;C:\\Files.ini&quot;));

	destSize=500;
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\KeineAhnung&quot;),LPWSTR(Pfad),destSize,TEXT(&quot;C:\\Files.ini&quot;));
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;NULL&quot;),LPWSTR(Version),destSize,TEXT(&quot;C:\\Files.ini&quot;)); 
	std::cout &lt;&lt; Version &lt;&lt; &quot;\n&quot;;
	std::cout &lt;&lt; Pfad &lt;&lt; &quot;\n&quot;;
	_getch();

}
</code></pre>
<p>Wenn ich meinen Code ausführe wird in der Konsole immer nur die ersten Buchstaben angezeigt also so:</p>
<pre><code>1
C
</code></pre>
<p>Was habe ich falsch gemacht?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516263</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516263</guid><dc:creator><![CDATA[SonnY]]></dc:creator><pubDate>Sun, 25 May 2008 12:09:45 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 12:10:27 GMT]]></title><description><![CDATA[<p>Verwende bitte <em>überall</em> TCHAR und konsorten, dann hast Du nie Probleme!</p>
<p>Also ersetze &quot;char&quot; durch &quot;TCHAR&quot;!</p>
<p>Und lass bitte unnötige casts weg; das deutet immer auf Fehler im Code hin!<br />
(Dein &quot;LPWSTR&quot;!)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516266</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 25 May 2008 12:10:27 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 12:18:01 GMT]]></title><description><![CDATA[<p>Wow das ging ja flott <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /><br />
der Compiler spuckt aber jetzt</p>
<pre><code>programm.cpp(17) : error C2664: 'GetPrivateProfileStringW': Konvertierung des Parameters 4 von 'TCHAR' in 'LPWSTR' nicht möglich
        Die Konvertierung eines ganzzahligen Typs in einen Zeigertyp erfordert ein reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat
programm.cpp(18) : error C2664: 'GetPrivateProfileStringW': Konvertierung des Parameters 4 von 'TCHAR' in 'LPWSTR' nicht möglich
        Die Konvertierung eines ganzzahligen Typs in einen Zeigertyp erfordert ein reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat
</code></pre>
<p>aus. Hier mein neuer Code</p>
<pre><code>TCHAR Pfad;
	TCHAR Version;
	DWORD destSize;

	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\Files.ini&quot;),TEXT(&quot;C:\\Files.ini&quot;));
	WritePrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;1.00&quot;),TEXT(&quot;C:\\Files.ini&quot;));

	destSize=500;
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Pfad&quot;),TEXT(&quot;C:\\KeineAhnung&quot;),Pfad,destSize,TEXT(&quot;C:\\Files.ini&quot;));
	GetPrivateProfileString(TEXT(&quot;files&quot;),TEXT(&quot;Version&quot;),TEXT(&quot;NULL&quot;),Version,destSize,TEXT(&quot;C:\\Files.ini&quot;)); 
	std::cout &lt;&lt; Version &lt;&lt; &quot;\n&quot;;
	std::cout &lt;&lt; Pfad &lt;&lt; &quot;\n&quot;;
	_getch();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1516270</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516270</guid><dc:creator><![CDATA[SonnY]]></dc:creator><pubDate>Sun, 25 May 2008 12:18:01 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 13:09:56 GMT]]></title><description><![CDATA[<p>Kannst Du eigentlich lesen?</p>
<p>Ich schrieb &quot;ersetze char durch TCHAR&quot;! Was hast Du gemacht?</p>
<pre><code class="language-cpp">char Pfad[100];
</code></pre>
<p>=&gt;</p>
<pre><code class="language-cpp">TCHAR Pfad[100];
</code></pre>
<p>Und das mit dem &quot;destSize&quot; lernen wir auch nochmals, bzw. lesen die Doku zu GetPrivateProfileString...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516314</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516314</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 25 May 2008 13:09:56 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 13:51:38 GMT]]></title><description><![CDATA[<p>das destSize stand in der F.A.Q trotzdem Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516320</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516320</guid><dc:creator><![CDATA[SonnY]]></dc:creator><pubDate>Sun, 25 May 2008 13:51:38 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 13:27:40 GMT]]></title><description><![CDATA[<p>Ja, natürlich war es so in der FAQ... aber Du hast Deinen Code geändert und dann sollte man halt schon wissen was man macht!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516324</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 25 May 2008 13:27:40 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 13:51:47 GMT]]></title><description><![CDATA[<p>ist es normal das &quot;0012FDC8&quot; als Ausgabe erscheint?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516347</guid><dc:creator><![CDATA[SonnY]]></dc:creator><pubDate>Sun, 25 May 2008 13:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 14:10:45 GMT]]></title><description><![CDATA[<p>Ja, da Du die DTL verwendest und dort wird der Zeiger auf den TCHAR ausgegeben...<br />
Das liegt daran, das die STL von TCHAR keine Ahnung hat... und Du C und C++ vermischt...</p>
<p>Der einfachheit halber verwende:</p>
<pre><code class="language-cpp">_tprintf
</code></pre>
<p>oder</p>
<pre><code class="language-cpp">#ifdef _UNICODE 
#define tcout std::wcout
#else
#define tcout std::cout
#endif
</code></pre>
<p>und dann</p>
<pre><code class="language-cpp">tcout &lt;&lt; Pfad;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1516361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516361</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 25 May 2008 14:10:45 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 14:16:47 GMT]]></title><description><![CDATA[<p>Danke jetzt funktionierts! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516367</guid><dc:creator><![CDATA[SonnY]]></dc:creator><pubDate>Sun, 25 May 2008 14:16:47 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Sun, 25 May 2008 14:37:01 GMT]]></title><description><![CDATA[<p>ich weiß nicht ob das hier rein gehört aber weil der thread schon existiert stelle ich mal meine frage: wie mache ich if abfragen mit tchar, und wie konvertiere ich tchar in string?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516386</guid><dc:creator><![CDATA[#SuperSonic#]]></dc:creator><pubDate>Sun, 25 May 2008 14:37:01 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Mon, 26 May 2008 13:15:17 GMT]]></title><description><![CDATA[<p>#SuperSonic# schrieb:</p>
<blockquote>
<p>ich weiß nicht ob das hier rein gehört aber weil der thread schon existiert stelle ich mal meine frage: wie mache ich if abfragen mit tchar, und wie konvertiere ich tchar in string?</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1516922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516922</guid><dc:creator><![CDATA[ist jemand da?!]]></dc:creator><pubDate>Mon, 26 May 2008 13:15:17 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Mon, 26 May 2008 13:38:18 GMT]]></title><description><![CDATA[<p>Je nach _UNICODE-Define entweder _gar keine Konvertierung_ oder mittels WideCharToMultiByte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516942</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 26 May 2008 13:38:18 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Mon, 26 May 2008 14:23:44 GMT]]></title><description><![CDATA[<p>und was ist mit if abfrage bei tchar?</p>
<pre><code class="language-cpp">if (antwort = &quot;so und so&quot;)
</code></pre>
<p>klappt net</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1516979</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1516979</guid><dc:creator><![CDATA[#SuperSonic#]]></dc:creator><pubDate>Mon, 26 May 2008 14:23:44 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Mon, 26 May 2008 16:46:33 GMT]]></title><description><![CDATA[<p>Das klappt unabhängig von TCHAR auch nicht mit char....<br />
Du meinst wohl &quot;_tcscmp&quot;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1517079</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1517079</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Mon, 26 May 2008 16:46:33 GMT</pubDate></item><item><title><![CDATA[Reply to GetPrivateProfileString nur erster Buchstabe on Mon, 26 May 2008 17:26:00 GMT]]></title><description><![CDATA[<p>storage.h:</p>
<pre><code>typedef char TCHAR
</code></pre>
<p>Ok, ein Newbie, aber gleich so einen Kram erzählen, ich weiß nicht ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1517107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1517107</guid><dc:creator><![CDATA[Scheppertreiber]]></dc:creator><pubDate>Mon, 26 May 2008 17:26:00 GMT</pubDate></item></channel></rss>