<?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[&amp;lt;vector&amp;gt;]]></title><description><![CDATA[<p>folgendes Programm funktioniert nicht wie es soll:</p>
<pre><code class="language-cpp">#define  _WIN32_WINNT  0x0501

#include &lt;windows.h&gt;
#include &lt;string.h&gt;
#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;vector&gt;

using namespace std;

int main(void)
{
	WIN32_FIND_DATA finddata;
	HANDLE hand;
	_TCHAR dirname[]=_T(&quot;f:\\TEMP\\*.*&quot;);
	int i=0;	

	DWORD dw=GetLastError();
	vector&lt;wchar_t*&gt; t;

	hand=FindFirstFile(dirname,&amp;finddata);

	if (hand==INVALID_HANDLE_VALUE)
	{
	printf(&quot;Hier geht nix!\n&quot;);
	return(-1);
	}
	else
	{
		wprintf(_T(&quot;%s\n&quot;),finddata.cFileName);

		while (FindNextFile(hand,&amp;finddata) !=0)	
		{		
			if (finddata.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY){
			//wenn Verzeichnis				
			}
			else	
			{
			//wenn Datei				
				t.push_back(finddata.cFileName);					
			}	
		}
	FindClose(hand);
	}			
return (0);
}
</code></pre>
<p>Fehlerbeschreibung: Der Vektor t ändert sich in seiner Länge, aber es werden immer alle Felder mit dem aktuell gefundenen Dateinamen überschrieben.(siehe Abb.)<br />
<a href="http://www.l8e.de/abb.png" rel="nofollow">http://www.l8e.de/abb.png</a></p>
<p>Gruß<br />
Daniel</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/136720/lt-vector-gt</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 14:01:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/136720.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 12 Feb 2006 18:13:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &amp;lt;vector&amp;gt; on Sun, 12 Feb 2006 18:13:46 GMT]]></title><description><![CDATA[<p>folgendes Programm funktioniert nicht wie es soll:</p>
<pre><code class="language-cpp">#define  _WIN32_WINNT  0x0501

#include &lt;windows.h&gt;
#include &lt;string.h&gt;
#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
#include &lt;tchar.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;vector&gt;

using namespace std;

int main(void)
{
	WIN32_FIND_DATA finddata;
	HANDLE hand;
	_TCHAR dirname[]=_T(&quot;f:\\TEMP\\*.*&quot;);
	int i=0;	

	DWORD dw=GetLastError();
	vector&lt;wchar_t*&gt; t;

	hand=FindFirstFile(dirname,&amp;finddata);

	if (hand==INVALID_HANDLE_VALUE)
	{
	printf(&quot;Hier geht nix!\n&quot;);
	return(-1);
	}
	else
	{
		wprintf(_T(&quot;%s\n&quot;),finddata.cFileName);

		while (FindNextFile(hand,&amp;finddata) !=0)	
		{		
			if (finddata.dwFileAttributes==FILE_ATTRIBUTE_DIRECTORY){
			//wenn Verzeichnis				
			}
			else	
			{
			//wenn Datei				
				t.push_back(finddata.cFileName);					
			}	
		}
	FindClose(hand);
	}			
return (0);
}
</code></pre>
<p>Fehlerbeschreibung: Der Vektor t ändert sich in seiner Länge, aber es werden immer alle Felder mit dem aktuell gefundenen Dateinamen überschrieben.(siehe Abb.)<br />
<a href="http://www.l8e.de/abb.png" rel="nofollow">http://www.l8e.de/abb.png</a></p>
<p>Gruß<br />
Daniel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/992461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/992461</guid><dc:creator><![CDATA[DanielN]]></dc:creator><pubDate>Sun, 12 Feb 2006 18:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;vector&amp;gt; on Sun, 12 Feb 2006 18:48:37 GMT]]></title><description><![CDATA[<p>Ja das ist normal so. Du speicherst immer den selben pointer in deinem vector.<br />
Also speicher anfordern, kopieren und dann erst in den vektor.<br />
Kurt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/992498</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/992498</guid><dc:creator><![CDATA[ZuK]]></dc:creator><pubDate>Sun, 12 Feb 2006 18:48:37 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;vector&amp;gt; on Sun, 12 Feb 2006 19:19:15 GMT]]></title><description><![CDATA[<p>ok, ich dachte das macht push_back für mich.</p>
<p>Gruß<br />
Daniel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/992537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/992537</guid><dc:creator><![CDATA[DanielN]]></dc:creator><pubDate>Sun, 12 Feb 2006 19:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to &amp;lt;vector&amp;gt; on Mon, 13 Feb 2006 08:52:23 GMT]]></title><description><![CDATA[<p>DanielN schrieb:</p>
<blockquote>
<p>ok, ich dachte das macht push_back für mich.</p>
</blockquote>
<p>Nein, push_back kopiert nur den Wert, den du ihm übergibst - in deinem Fall den Inhalt des Pointers (Adresse). Wenn du etwas anderes haben willst, benötigst du intelligentere Objekte (die sich beim Kopieren um eigenen Speicherplatz bemühen).</p>
<p>(für dein Beispiel empfehle ich einen vector&lt;wstring&gt; statt des vector&lt;wchar_t*&gt;)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/992836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/992836</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Mon, 13 Feb 2006 08:52:23 GMT</pubDate></item></channel></rss>