<?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[Alle Dateien von C: auflisten...]]></title><description><![CDATA[<p>Hab mir mal den Beispiel Code vom Forum angeguckt:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39396.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39396.html</a></p>
<p>Was müsste man ändern, dass man wirklich <strong>alle</strong> Dateien auflisten kann, also alle Verzeichnisse, Unterordner...<br />
Am Ende müsste die gleiche Anzahl von Dateien stehen wie bei der Eigenschaft von C:</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123193/alle-dateien-von-c-auflisten</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Jul 2026 20:04:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123193.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Oct 2005 19:04:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 19:05:19 GMT]]></title><description><![CDATA[<p>Hab mir mal den Beispiel Code vom Forum angeguckt:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39396.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39396.html</a></p>
<p>Was müsste man ändern, dass man wirklich <strong>alle</strong> Dateien auflisten kann, also alle Verzeichnisse, Unterordner...<br />
Am Ende müsste die gleiche Anzahl von Dateien stehen wie bei der Eigenschaft von C:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891707</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Thu, 13 Oct 2005 19:05:19 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 19:20:23 GMT]]></title><description><![CDATA[<pre><code>procedure dir_list ( root : string )

    while weitere datei in root gefunden

        if dateityp = verzeichnis then
            dir_list(datei)
        else
            out datei in root gefunden

end procedure
</code></pre>
<p>Den Rest solltest du dir aus dem Thread rauspicken können.</p>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891721</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Thu, 13 Oct 2005 19:20:23 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 19:23:33 GMT]]></title><description><![CDATA[<p>Du müsstest mit GetFileAttribute überprüfen, ob das aktuelle Element ein Verzeichnis ist. Falls ja, musst du in dieses Verzeichnis wechseln und dort wieder alle Dateien und Verzeichnisse auflisten.<br />
Das lässt sich am besten mit einer rekursiven Funktion erreichen, die einen Pfad als Parameter erwartet, dessen Dateien sie zählt. Und wenn du in der Funktion ein Verzeichnis findest, rufst du sie selbst nochmal mit dem neuen Pfad auf.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891726</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891726</guid><dc:creator><![CDATA[masterofx32]]></dc:creator><pubDate>Thu, 13 Oct 2005 19:23:33 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 19:25:53 GMT]]></title><description><![CDATA[<p>masterofx32 schrieb:</p>
<blockquote>
<p>Du müsstest mit GetFileAttribute überprüfen, ob das aktuelle Element ein Verzeichnis ist. Falls ja, musst du in dieses Verzeichnis wechseln und dort wieder alle Dateien und Verzeichnisse auflisten.<br />
Das lässt sich am besten mit einer rekursiven Funktion erreichen, die einen Pfad als Parameter erwartet, dessen Dateien sie zählt. Und wenn du in der Funktion ein Verzeichnis findest, rufst du sie selbst nochmal mit dem neuen Pfad auf.</p>
</blockquote>
<p>In WIN32_FIND_DATA findest du bereits ob das Verzeichnis ein Directory ist, GetFileAttribute() brauchst du gar nicht.</p>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891729</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Thu, 13 Oct 2005 19:25:53 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 19:39:33 GMT]]></title><description><![CDATA[<p>Sobald die laufende Funktion ein Verzeichniss erkennt, soll die Funktion wieder aufgerufen werden und als Parameter das aktuelle Verzeichniss dursuchen. Hab aber ein Fehler sobald die laufende Funktion sich selbst nochmal starten soll. Das hab ich zusammengestelt:</p>
<pre><code class="language-cpp">string scan(string str)
{

	HANDLE fHandle;
	WIN32_FIND_DATA wfd;

	string Dir = str + &quot;\\*&quot;;
	fHandle=FindFirstFile(Dir.c_str(),&amp;wfd);

	string verzeichnis;
	string leer = &quot;\n&quot;;
	string tab = &quot;		&quot;;

	do
	{	  
		if (!( (wfd.cFileName[0]=='.') &amp;&amp; ( (wfd.cFileName[1]=='.' &amp;&amp; wfd.cFileName[2]==0) || wfd.cFileName[1]==0 ) ))
	  	{		
			if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
			{
				//Verzeichnis...

				scan(wfd.cAlternateFileName);	// Hier liegt der Fehler!					
				verzeichnis += wfd.cFileName + tab + leer; 	  	
			} 

			else 
			{
				//Dateien...
				//verzeichnis += wfd.cFileName + tab + leer; 	  
			}
			//verzeichnis += wfd.cFileName + tab + leer; 	  
		}

	}while (FindNextFile(fHandle,&amp;wfd));
	FindClose(fHandle);

	return verzeichnis;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/891741</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891741</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Thu, 13 Oct 2005 19:39:33 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 20:22:10 GMT]]></title><description><![CDATA[<p>Du musst dir mit str wieder den kompletten Pfad zusammenbasteln...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891794</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Thu, 13 Oct 2005 20:22:10 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Thu, 13 Oct 2005 20:34:31 GMT]]></title><description><![CDATA[<p>Wie kann ich am besten in der if Schleife das aktuelle Verzeichnis auslesen und weiterverarbeiten:</p>
<pre><code class="language-cpp">verzeichnis = &quot;C:\\&quot; + wfd.cFileName;

scan(verzeichnis);
</code></pre>
<p>So jetzt will ich nicht jedesmal den pfad angeben wie oben, es soll automatisch rausfinden in welchem verzeichnis es sich nun befindet</p>
]]></description><link>https://www.c-plusplus.net/forum/post/891807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/891807</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Thu, 13 Oct 2005 20:34:31 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 08:58:48 GMT]]></title><description><![CDATA[<p>Du hast du in str den Verzeichnis-Pfad bis zur aktuellen Ebene drin - da musst du dann einfach noch wfd.cFileName anhängen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892086</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Fri, 14 Oct 2005 08:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 12:47:41 GMT]]></title><description><![CDATA[<p>Habs hinbekommen mit den Verzeichnissen, aber jetzt hab ich ein anderes Problem:</p>
<pre><code class="language-cpp">string scan(string str)
{
	HANDLE fHandle;
	WIN32_FIND_DATA wfd;

	string Dir = str + &quot;\\&quot; + &quot;*&quot;;
	fHandle=FindFirstFile(Dir.c_str(),&amp;wfd);

	string leer = &quot;\n&quot;;
	string slash = &quot;\\&quot;;

	string ScanDir;
	string ScanFile;

	string back; //Rückgabewert

	do
	{	  
		if (!( (wfd.cFileName[0]=='.') &amp;&amp; ( (wfd.cFileName[1]=='.' &amp;&amp; wfd.cFileName[2]==0) || wfd.cFileName[1]==0 ) ))
	  	{		
			if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
			{

				//Verzeichnis...		

				ScanDir = str + &quot;\\&quot; + wfd.cFileName;

				scan(ScanDir);							
			} 

			else 
			{
				//Dateien...

				ScanFile = str + &quot;\\&quot; + wfd.cFileName;
				//cout &lt;&lt; ScanFile &lt;&lt; endl;

				//scan(ScanFile);
			}

			back = ScanFile;
			//cout &lt;&lt; back &lt;&lt; endl;

			return back;

		}

	}while (FindNextFile(fHandle,&amp;wfd));

	FindClose(fHandle);

	return back;
}
</code></pre>
<p>Wenn ich back ausgebe mit cout dann werden alle verzeichnisse + file ausgegeben, aber ich möchte das back zurückgegeben wird aber es passiert nichts wenn ich die funktion mit cout &lt;&lt; scan(&quot;c:\&quot;); ausgebe. HILFE</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892307</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892307</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 12:47:41 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 13:38:41 GMT]]></title><description><![CDATA[<p>kernel64 schrieb:</p>
<blockquote>
<p>es passiert nichts wenn ich die funktion mit cout &lt;&lt; scan(&quot;c:\&quot;); ausgebe. HILFE</p>
</blockquote>
<p>Was soll denn da passieren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892366</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892366</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Fri, 14 Oct 2005 13:38:41 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 13:55:45 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>Was soll denn da passieren?</p>
</blockquote>
<p>Es soll sowas zurückgegeben werden:</p>
<p>c:\\Windows\<br />
c:\\Windows\test.txt<br />
...</p>
<p>Also alle Dateien mit Datein mit dem Pfad in einem String, aber das müsste normalerweise funktionieren da back jedesmal ein neuen string mit der datei erhält und zurückgibt. Es wird nix ausgegeben wenn ich back zurückgebe aber wenn ich direkt back in der funktion ausgebe dann gehts.</p>
<p>Info: Die return Anweisung in der Schleife muss raus (return back)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892381</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 13:55:45 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 13:57:35 GMT]]></title><description><![CDATA[<p>kernel64 schrieb:</p>
<blockquote>
<p>Es wird nix ausgegeben wenn ich back zurückgebe aber wenn ich direkt back in der funktion ausgebe dann gehts.</p>
</blockquote>
<p>Logisch. Du überschreibst den Inhalt ja immer wieder mit dem aktuellen Dateinamen.</p>
<p>Wenn du die Namen sammeln willst, musst du nicht ersetzen, sondern anhängen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892383</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892383</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Fri, 14 Oct 2005 13:57:35 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 14:01:43 GMT]]></title><description><![CDATA[<p>stimmt das war mein Problem THX jetzt gehts <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>
]]></description><link>https://www.c-plusplus.net/forum/post/892385</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892385</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 14:24:20 GMT]]></title><description><![CDATA[<p>Ich hab mich doch wohl zu gefreut, ich hatte ja noch cout in der funktion und die hat alles ausgegeben, so wie mach ich das jetzt langsam verliere ich aber die Geduld. Jetzt hab ich:</p>
<pre><code>back += ScanFile + leer;
</code></pre>
<p>in die else schleife eingefügt. Wenn ich funktion ausführe dann wird nix ausgegeben aber auf die festplatte wird zugegriffen</p>
<p>Bitte um Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892405</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:24:20 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 14:30:04 GMT]]></title><description><![CDATA[<p>Den Rückgabewert des rekursiven Aufrufs musst du auch noch anhängen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892410</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Fri, 14 Oct 2005 14:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 15:03:26 GMT]]></title><description><![CDATA[<p>Wieso werden hiermit einige dateien doppelt aufgezählt?</p>
<p>Kannste bitte überprüfen ob die funktion richtig ist und ob die ausgaben korrekt sind. Wieso sind zwischen zeilen so große abstände?</p>
<pre><code class="language-cpp">string scan(string str)
{
	HANDLE fHandle;
	WIN32_FIND_DATA wfd;

	string Dir = str + &quot;\\&quot; + &quot;*&quot;;
	fHandle=FindFirstFile(Dir.c_str(),&amp;wfd);

	string leer = &quot;\n&quot;;
	string slash = &quot;\\&quot;;

	string ScanDir;
	string ScanFile;
	string newDir;

	string back; //Rückgabewert

	do
	{	  
		if (!( (wfd.cFileName[0]=='.') &amp;&amp; ( (wfd.cFileName[1]=='.' &amp;&amp; wfd.cFileName[2]==0) || wfd.cFileName[1]==0 ) ))
	  	{		
			if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
			{
				//Verzeichnis...					
				ScanDir = str + &quot;\\&quot; + wfd.cFileName;

				newDir += scan(ScanDir);	

				back += newDir + leer;
			}			

			else 
			{
				//Dateien...
				ScanFile = str + &quot;\\&quot; + wfd.cFileName;	

				back += ScanFile + leer;
			}	

		//	back += ScanFile + leer;			
		//	cout &lt;&lt; &quot;back: &quot; &lt;&lt; back;				

		}

	}while (FindNextFile(fHandle,&amp;wfd));
	FindClose(fHandle);

	return back;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/892433</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892433</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 15:03:26 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 15:20:38 GMT]]></title><description><![CDATA[<p>Zwei Fehler: Du prüfst den Rückgabewert von FindFirstFile nicht. Wenn du da INVALID_HANDLE_VALUE bekommst, brauchst du auch nicht weitersuchen.</p>
<p>Außerdem hängst du nicht nur an back, sondern auch an newDir an. Wenn du also Unverzeichnisse durchsuchst, hängst du den Inhalt des 1. Unterverzeichnisses an, dann den Inhalt des 1. und des 2., dann den Inhalt des 1., 2. und 3. usw. Dadurch sind alle bis auf das letzte Unterverzeichnis mehrfach enthalten. Du darfst hier also nicht an newDir anhängen, sondern nur zuweisen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892448</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892448</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Fri, 14 Oct 2005 15:20:38 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 15:39:26 GMT]]></title><description><![CDATA[<p>So jetzt hab alles ich verbessert, wenn ich aber in der main die funktion aufrufe dann wird so lange nix ausgegeben bis alle verzeichnisse im string gespeichert sind, aber ich möchte gerne das die aktuellen verzeichnisse noch ausgegeben werden wie z.B:</p>
<p>Asugabe:</p>
<p>Scanning: c:\\test.txt</p>
<p>Das zweiter problem wie kann ich die ausgabe mit auf der gleichen zeile ausgeben denn mit &quot;\r&quot; gehts nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892466</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892466</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 15:39:26 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 16:40:41 GMT]]></title><description><![CDATA[<p>hmm pack halt:</p>
<pre><code class="language-cpp">// ...
if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY) 
{ 
    //Verzeichnis...                    
    ScanDir = str + &quot;\\&quot; + wfd.cFileName; 
    cout &lt;&lt; &quot;Scanning &quot; &lt;&lt; ScanDir; // sollte doch reichen...
    newDir += scan(ScanDir);  
    back += newDir + leer; 
 }
// ...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/892503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892503</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 14 Oct 2005 16:40:41 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 16:53:28 GMT]]></title><description><![CDATA[<p>Am liebsten hätte ich die ausgabe so das scanning immer vorn ist und das immer auf der gleichen zeile dann die datei steht, also es soll nur eine Zeile verwendet werden. Habs damit probiert:</p>
<pre><code class="language-cpp">printf(&quot;Scanning: &quot;);
printf(&quot;%s \r&quot;, ScanFile);
</code></pre>
<p>aber dabei gibts ein fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892513</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 16:53:28 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 19:23:31 GMT]]></title><description><![CDATA[<p>hmm.. was für ein Fehler ?! das sollte man immer dazu sagen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892596</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Fri, 14 Oct 2005 19:23:31 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Fri, 14 Oct 2005 21:11:26 GMT]]></title><description><![CDATA[<p>Was muss man ändern dass z.b. oben fest &quot;Scanning...&quot; steht und da drunter auf der zeile jedesmal dann die datei:</p>
<pre><code>Scanning...
c:\test.txt
</code></pre>
<p>So jetzt auf der zeile wo die datei ausgegeben wird sollen auch die anderen ausgegeben werden und jedesmal neu ausgegeben werden</p>
]]></description><link>https://www.c-plusplus.net/forum/post/892653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/892653</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Fri, 14 Oct 2005 21:11:26 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Sun, 16 Oct 2005 12:41:08 GMT]]></title><description><![CDATA[<p>Ich hab versucht jede Datei zu zählen dabei habe ich eine globale Variable verwendet, aber irgendwie kommen da zahlen raus mit größeren abständen:</p>
<pre><code class="language-cpp">int i = 0; //Global

string ListDirectory(string str)
{
	HANDLE fHandle;
	WIN32_FIND_DATA wfd;

	string Dir = str + &quot;\\&quot; + &quot;*&quot;;
	fHandle=FindFirstFile(Dir.c_str(),&amp;wfd);

	string leer = &quot;\n&quot;;
	string slash = &quot;\\&quot;;

	string ScanDir;
	string ScanFile;
	string newDir;

	string back; //Rückgabewert

	do	
	{
		i++;
                string anzahl =intStr(i); //Int nach String

		if (!( (wfd.cFileName[0]=='.') &amp;&amp; ( (wfd.cFileName[1]=='.' &amp;&amp; wfd.cFileName[2]==0) || wfd.cFileName[1]==0 ) ))
	  	{
			// Verzeichnis...
			if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
			{						
				ScanDir = str + wfd.cFileName;
				newDir += ListDirectory(ScanDir);													
				back = anzahl + &quot; &quot; + newDir;
			}			

			// Dateien...
			else 
			{					
	 			ScanFile =str + wfd.cFileName;								
                                back +=  anzahl + &quot; &quot; + ScanFile + leer;
			}
		}

	}while (FindNextFile(fHandle,&amp;wfd));
	FindClose(fHandle);

	return back;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/893425</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893425</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Sun, 16 Oct 2005 12:41:08 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Sun, 16 Oct 2005 13:20:22 GMT]]></title><description><![CDATA[<p>Da sollten keine Abstände drin sein. Aber bei deiner Vorgehensweise werden die Verzeichnisse mitgezählt, und die Zahlen stehen nicht in aufsteigender Reihenfolge im Text.</p>
<p>Vielleicht vollziehst du deinen Algorithmus einfach mal auf dem Papier nach, dann sollte dir das klar werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893447</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893447</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Sun, 16 Oct 2005 13:20:22 GMT</pubDate></item><item><title><![CDATA[Reply to Alle Dateien von C: auflisten... on Sun, 16 Oct 2005 15:10:54 GMT]]></title><description><![CDATA[<p>Das mit den Abständen ist ja nicht schlimm da die zahl vor der datei steht.<br />
Habs bißchen geändert aber bringt nichts da bei mehreren unterordner ganz was anderes rauskommt</p>
<pre><code class="language-cpp">// Verzeichnis...
			if (wfd.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY)
			{						
				ScanDir = str + &quot;\\&quot; + wfd.cFileName;
				newDir += ListDirectory(ScanDir);

				back = newDir;
			}			

			// Dateien...
			else 
			{				
				i++;
				string anzahl = intStr(i);

				ScanFile = str + &quot;\\&quot; + wfd.cFileName;					
				back += anzahl + &quot; &quot; + ScanFile + leer;
			}
</code></pre>
<p>Sobald sich in einem Verzeichniss mehrere Dateien befinden, zeigt das programm nur diese an, dabei werden die restlichen unterordner nicht mehr durchsucht.</p>
<p>z.B.</p>
<p>c:\test\A\B\C</p>
<p>Im Ordner A sind Dateien dann werden diese ausgegeben und das prog schließt, was muss machen das er weiter sucht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/893506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/893506</guid><dc:creator><![CDATA[kernel64]]></dc:creator><pubDate>Sun, 16 Oct 2005 15:10:54 GMT</pubDate></item></channel></rss>