<?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[Fragen zu GetPrivateProfileString]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>kann mir jemand einen Tip geben ??</p>
<p>Ich möchte mit GetPrivateProfileString eine ini Datei einlesen.</p>
<p>Jetzt wird die Ini Datei nicht von mir gefüllt, sondern von x belibigen.</p>
<p>Nun möchte ich unter einem bestimmten z.b [common] alle einträge haben.</p>
<p>Der Inhalt der ini Datei:</p>
<pre><code>[common]
1=c:\lol\;Hallo
2=d:\test\;Jetzt
</code></pre>
<p>Hier der Source:</p>
<pre><code class="language-cpp">char EinPfad[500];
DWORD destSize; 
int zaehler = 1;
destSize=500;
do
{
GetPrivateProfileString(&quot;common&quot;,CUtil::IntinString(zaehler).c_str(),&quot;NULL&quot;,EinPfad,destSize,m_cDaten.getIniPfad().c_str()); 
std::cout &lt;&lt; EinPfad &lt;&lt; std::endl;
zaehler++;
}while(zaehler &lt;= 2);
</code></pre>
<p>Kann mir jemand sagen wie ich die Anzahl auslese, so dass ich diese nicht vordefenieren muß</p>
<p>Gruß und Danke<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/73985/fragen-zu-getprivateprofilestring</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 12:25:54 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/73985.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 May 2004 09:27:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Sun, 16 May 2004 09:27:54 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>kann mir jemand einen Tip geben ??</p>
<p>Ich möchte mit GetPrivateProfileString eine ini Datei einlesen.</p>
<p>Jetzt wird die Ini Datei nicht von mir gefüllt, sondern von x belibigen.</p>
<p>Nun möchte ich unter einem bestimmten z.b [common] alle einträge haben.</p>
<p>Der Inhalt der ini Datei:</p>
<pre><code>[common]
1=c:\lol\;Hallo
2=d:\test\;Jetzt
</code></pre>
<p>Hier der Source:</p>
<pre><code class="language-cpp">char EinPfad[500];
DWORD destSize; 
int zaehler = 1;
destSize=500;
do
{
GetPrivateProfileString(&quot;common&quot;,CUtil::IntinString(zaehler).c_str(),&quot;NULL&quot;,EinPfad,destSize,m_cDaten.getIniPfad().c_str()); 
std::cout &lt;&lt; EinPfad &lt;&lt; std::endl;
zaehler++;
}while(zaehler &lt;= 2);
</code></pre>
<p>Kann mir jemand sagen wie ich die Anzahl auslese, so dass ich diese nicht vordefenieren muß</p>
<p>Gruß und Danke<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/521183</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/521183</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Sun, 16 May 2004 09:27:54 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Sun, 16 May 2004 09:36:31 GMT]]></title><description><![CDATA[<p>Schau Dir mal <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getprivateprofilesection.asp" rel="nofollow">MSDN: GetPrivateProfileSection</a> an.</p>
<p>Holt eine komplette Sektion (in Deinem Falle [common]) aus der INI.<br />
Einzelne Keys sind durch '\0' voneinander getrennt, abgeschlossen ist der String mit '\0\0'.</p>
<p>Oder evtl. <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getprivateprofilesectionnames.asp" rel="nofollow">GetPrivateProfileSectionNames</a>.</p>
<p>Holt nur die Namen aller Keys in der Sektion.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/521188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/521188</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Sun, 16 May 2004 09:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Sun, 16 May 2004 09:45:07 GMT]]></title><description><![CDATA[<p>hmm..</p>
<p>ich danke DIr,</p>
<p>ich komme allerdings nicht so ganz zu recht, was Du mit \0 und \0\0 meinst.</p>
<p>Woher weiss er denn, wann er am ende ist ??</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/521193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/521193</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Sun, 16 May 2004 09:45:07 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Sun, 16 May 2004 10:34:49 GMT]]></title><description><![CDATA[<p>Hallo, kann mir keiner Helfen ??</p>
<p>einen einzelnen Bereich bekomme ich heraus, aber nicht wenn mehrere einträge unter einander stehen...</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/521225</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/521225</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Sun, 16 May 2004 10:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Sun, 16 May 2004 11:43:21 GMT]]></title><description><![CDATA[<p>Du musst einfach den Pointer um die Stringlänge + 1 (0-Zeichen) weitersetzen - wenn dann ein leerer String kommt gibt es keine weiteren Einträge mehr <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Und sei mal nicht so ungeduldig <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/521280</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/521280</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Sun, 16 May 2004 11:43:21 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 08:33:19 GMT]]></title><description><![CDATA[<p>Also Leute,</p>
<p>ich glaub ich bin zu blöd,<br />
ich bekomme es nicht hin...</p>
<pre><code class="language-cpp">char EinPfad[500];
int zaehler = 0;

do
{
GetPrivateProfileSection(&quot;Such Objekt&quot;,EinPfad,zaehler,&quot;test.ini&quot;); 

if(EinPfad+1 == '\0')
{
std::cout &lt;&lt; EinPfad &lt;&lt; endl;
}
zaehler++;

}while(EinPfad+1 != '\0\0');
</code></pre>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522469</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Tue, 18 May 2004 08:33:19 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 08:47:39 GMT]]></title><description><![CDATA[<p>1.) Wenn du die ini-Datei im Programm-Verzeichnis ablegst solltest du eine absolute Pfad-Angabe verwenden.<br />
2.) GetPrivateProfileSection muss nur ein Mal aufgerufen werden. Es wird dann in den Buffer (muss groß genug sein) der Inhalt der Section in Form eines String-Arrays eingelesen. Um dies auszulesen gehst du es in einer while-Schleife durch und setzt immer den Pointer um lstrlen(buffer)+1 weiter.<br />
Wenn du die Schlüssel aber systematisch durchnummeriert hast könntest du auch alles einzeln auslesen (erst 1, dann 2, usw. bis du nur noch den Default-Wert bekommst)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522484</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522484</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Tue, 18 May 2004 08:47:39 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 08:50:29 GMT]]></title><description><![CDATA[<p>Das sieht dann ungefähr so aus (ungetestet):</p>
<pre><code class="language-cpp">char buffer[1024]; 
int zaehler = 1024; 

GetPrivateProfileSection(&quot;Such Objekt&quot;,EinPfad,buffer,&quot;c:\\deinpfad\\test.ini&quot;); 

while(lstrlen(buffer) != 0) {
 std::cout &lt;&lt; buffer&lt;&lt; endl; 
 buffer += lstrlen(buffer) + 1;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/522486</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522486</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Tue, 18 May 2004 08:50:29 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 09:21:12 GMT]]></title><description><![CDATA[<p>sorry, ich sehe wahrscheinlich jetzt den Baum vor Bäumen nicht.</p>
<p>Es tut nicht....</p>
<p>error C2664: 'GetPrivateProfileSectionA' : Konvertierung des Parameters 3 von 'char [1024]' in 'unsigned long' nicht moeglich<br />
Diese Konvertierung erfordert einen reinterpret_cast-Operator oder eine Typumwandlung im C- oder Funktionsformat<br />
error C2106: '+=' : Linker Operand muss ein L-Wert sein</p>
<p>Für was setzt Du den</p>
<pre><code class="language-cpp">int zaehler = 1024;
</code></pre>
<p>ein ?</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522495</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Tue, 18 May 2004 09:21:12 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 09:39:41 GMT]]></title><description><![CDATA[<p>so geht's</p>
<pre><code class="language-cpp">int main(int argc, char *argv[])
{
	char buffer[512];

	GetPrivateProfileSection(&quot;common&quot;, buffer, sizeof(buffer), &quot;d:\\test.ini&quot;);

	char *pBuffer = buffer;

	while(strlen(pBuffer) != 0)
	{
		std::cout &lt;&lt; pBuffer &lt;&lt; std::endl;
		pBuffer += strlen(pBuffer) + 1;
	}

	system(&quot;pause&quot;);
	return 0;
}
</code></pre>
<p>achtung bei der grösse des buffers, siehe:<br />
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getprivateprofilesection.asp" rel="nofollow">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getprivateprofilesection.asp</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/522503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522503</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Tue, 18 May 2004 09:39:41 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 09:47:51 GMT]]></title><description><![CDATA[<p>Ooohhh vielen Dank,</p>
<p>es tut.<br />
Man war das eine Geburt.<br />
Zu dem Buffer, das heißt max 500 einträge sind möglich ?</p>
<p>Ich benütze nur Win 2000 od. Win XP.</p>
<p>Die einträge werden nicht mehr als ca. 100 werden.</p>
<p>Sollte also gehen.</p>
<p>Gruß<br />
andy_mann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522513</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Tue, 18 May 2004 09:47:51 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 10:02:35 GMT]]></title><description><![CDATA[<p>andy_mann schrieb:</p>
<blockquote>
<p>Zu dem Buffer, das heißt max 500 einträge sind möglich ?</p>
</blockquote>
<p>nein, die einträge (alle) dürfen nicht grösser sein als 512bytes.<br />
1zeichen == 1byte, dazu kommen noch die terminierungen ('\0').</p>
<p>andy_mann schrieb:</p>
<blockquote>
<p>Die einträge werden nicht mehr als ca. 100 werden.</p>
</blockquote>
<p>dann müsstest du den buffer vergrössern.<br />
bsp: 512 / 100 = ~5 zeichen pro eintrag</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522521</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522521</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Tue, 18 May 2004 10:02:35 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 10:12:52 GMT]]></title><description><![CDATA[<p>ahja,</p>
<p>ich habe ihn auf 20480 erhöht,</p>
<p>das sollten dann 200 Zeillen mit a ca. 100 Zeichen sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/522532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522532</guid><dc:creator><![CDATA[andy_mann]]></dc:creator><pubDate>Tue, 18 May 2004 10:12:52 GMT</pubDate></item><item><title><![CDATA[Reply to Fragen zu GetPrivateProfileString on Tue, 18 May 2004 10:24:36 GMT]]></title><description><![CDATA[<p>bei solchen werten solltest du dir überlegen ob es nicht sinn macht alles in eine andere datei zu speichern.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;

int main(int argv, int *argc[])
{
   ifstream file(&quot;test.txt&quot;);
   vector&lt;string&gt; str_vec;
   string temp;

   while(getline(file, temp))
        str_vec.push_back(temp);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/522542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/522542</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Tue, 18 May 2004 10:24:36 GMT</pubDate></item></channel></rss>