<?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[FindFirstFile - FindNextFile reihenfolge]]></title><description><![CDATA[<p>hoi leute</p>
<p>wie sieht das aus ? bekommt man da die dateien eigendlich immer nach dem alphabet sortiert ? oder ist das willkuerlich oder kann man das auch steuern ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/113936/findfirstfile-findnextfile-reihenfolge</link><generator>RSS for Node</generator><lastBuildDate>Thu, 02 Jul 2026 00:41:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/113936.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Jun 2005 14:43:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 14:43:54 GMT]]></title><description><![CDATA[<p>hoi leute</p>
<p>wie sieht das aus ? bekommt man da die dateien eigendlich immer nach dem alphabet sortiert ? oder ist das willkuerlich oder kann man das auch steuern ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819097</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819097</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Tue, 28 Jun 2005 14:43:54 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 15:09:22 GMT]]></title><description><![CDATA[<p>Meep Meep schrieb:</p>
<blockquote>
<p>bekommt man da die dateien eigendlich immer nach dem alphabet<br />
sortiert ?</p>
</blockquote>
<p>msdn schrieb:</p>
<blockquote>
<p>Remarks<br />
The FindNextFile function searches for files by name only; it cannot be used for attribute-based searches. It searches both the long and short file names.</p>
</blockquote>
<p>Meep Meep schrieb:</p>
<blockquote>
<p>kann man das auch steuern ?</p>
</blockquote>
<p>wenn du es steuern möchtest lies es doch zb: in ein c++ vector ein und sortierte<br />
nach was du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819118</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Tue, 28 Jun 2005 15:09:22 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 17:24:06 GMT]]></title><description><![CDATA[<p>re</p>
<p>so mach ich es derzeit ja. ich sortiere immer nach dem alphabet.<br />
aber das koennte ich mir ersparen, wenn ich wuesste, das ich es sowieso schon immer sortiert bekomme. deshalb auch die frage, ob ich mich darauf verlassen kann, das es auch immer so ist.</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819218</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Tue, 28 Jun 2005 17:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 17:37:52 GMT]]></title><description><![CDATA[<p>genauer mein beitrag lesen <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="😉"
    /><br />
hört sich mich nach alphabet sortierung an</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819231</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819231</guid><dc:creator><![CDATA[miller_m]]></dc:creator><pubDate>Tue, 28 Jun 2005 17:37:52 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 17:49:36 GMT]]></title><description><![CDATA[<p>re</p>
<p>miller_m schrieb:</p>
<blockquote>
<p>[quote=&quot;msdn schrieb]<br />
Remarks<br />
The FindNextFile function searches for files by name only; it cannot be used for attribute-based searches. It searches both the long and short file names.</p>
</blockquote>
<p>[/quote]</p>
<p>also fuer mich hoert sich das eher danach an, das er nur nach dateinamen suchen kann. also &quot;he*&quot;. alles das mit he anfaengt. das das nun auch nach dem alphabet sortiert ist, kann ich da nicht raus lesen.<br />
aber ich vertrau dir mal, das das so ist.<br />
beim uebersetzen von englischen texten is jeder besser als ich</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819239</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Tue, 28 Jun 2005 17:49:36 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 19:12:28 GMT]]></title><description><![CDATA[<p>Na vieleicht gehört es nicht ganz hier her und es ist ein bißchen Komplexer<br />
weil ich &quot;keine Zeit&quot; beim sortieren habe, benutze ich ein CArray mit Zeigern<br />
und ein CArray mit den Daten<br />
Schau es dir mal an, als Überlegung :</p>
<pre><code class="language-cpp">class DIRINFO
{	
#define USI	unsigned short int 
	private: 
		char			BasisDir[MAX_PATH];
		char			fileFilter[50];
		char			SortAtIdx;
		int				anzDir;								// Anzahl der Verzeichnisse
		int				anzFile;							// Anzahl der &quot;NICHT-Verzeihnisse&quot;
		bool			isDesc;
		CArray&lt;WIN32_FIND_DATA,WIN32_FIND_DATA&gt; FileList;
		CArray&lt;USI,USI&gt; FileIdx; 
		void  printList(FILE* myFile);						// Sortiertes Array in Datei schreiben
...
		bool  innerSort(char idx);							// eigentliche Sortierungsroutine
		int   innerRead();									// Verzeichnis lesen
		int   innerComp(LPWIN32_FIND_DATA valOne,
			           LPWIN32_FIND_DATA valTwo, char idx);	// Vergleichroutine
														    // -1 Fehler  beim Vergleich
															//  1 Wertefolge kann erhalten bleiben
															//  2 Wertefolge muss vertausch werden

public:
	  bool  setBasisDir(char* baseVerz,bool bsort = true);	// Basisverzeichnis setzen
};
bool DIRINFO::setBasisDir(char* baseVerz, bool bsort)
{	bool result = false;
	char tempPath[MAX_PATH];
	int lenPth = strlen(baseVerz);
	if( lenPth &lt; 2 || lenPth &gt; MAX_PATH-10) return result;
	strcpy(tempPath,baseVerz);
	if(tempPath[lenPth] == '\\') tempPath[lenPth] = 0;
	if(_access(tempPath,4) == -1 || !waitForUnLock()) return result;
	strcpy(BasisDir,tempPath);
	locked = true; result = true;
	FileList.RemoveAll(); FileIdx.RemoveAll();
    anzDir = 0; anzFile	= 0; 
	if(!bsort) isDesc = true;
	else       isDesc = false;
	if(innerRead() &gt; 1) innerSort(SortAtIdx);
	locked = false;
	return result;
}

bool DIRINFO::innerSort(char idx)
{	bool result = true;
	int iCount1,iCount2;
    int maxCount1,maxCount2;
    USI buffer;
	maxCount1 = anzDir;
	for(iCount1 = 0; iCount1 &lt; maxCount1; iCount1++,maxCount1--)
	{	maxCount2 = maxCount1 - 1;
		for(iCount2 = 0; iCount2 &lt; maxCount2; iCount2++)
		{	if(innerComp(&amp;FileList[FileIdx[iCount2&rsqb;&rsqb;,&amp;FileList[FileIdx[iCount2+1&rsqb;&rsqb;,idx) == 2)
			{	buffer = FileIdx[iCount2];
				FileIdx[iCount2] = FileIdx[iCount2+1];
				FileIdx[iCount2+1] = buffer;
			};
		};
	};

	maxCount1 = anzFile+anzDir;
	for(iCount1 = anzDir; iCount1 &lt; maxCount1; iCount1++,maxCount1--)
	{	maxCount2 = maxCount1 - 1;
		for(iCount2 = anzDir; iCount2 &lt; maxCount2; iCount2++)
		{	if(innerComp(&amp;FileList[FileIdx[iCount2&rsqb;&rsqb;,&amp;FileList[FileIdx[iCount2+1&rsqb;&rsqb;,idx) == 2)
			{	buffer = FileIdx[iCount2];
				FileIdx[iCount2] = FileIdx[iCount2+1];
				FileIdx[iCount2+1] = buffer;
			};
		};
	};

	return result;
};
int DIRINFO::innerRead()
{	int count=0;
	HANDLE fHandle;
	WIN32_FIND_DATA tmpData;
	char tempFile[MAX_PATH];
	sprintf(tempFile,&quot;%s\\%s&quot;,BasisDir,fileFilter);
	if( (fHandle = FindFirstFile(tempFile,&amp;tmpData)) != INVALID_HANDLE_VALUE)
	{	do
		{   if(tmpData.cFileName[0] != '.')
			{	if( ((tmpData.dwFileAttributes &gt;&gt; 4)%2) == 1)  
				{	FileList.InsertAt(0,tmpData,1); anzDir++; 
				} else 
				{	FileList.Add(tmpData); anzFile++;
				};
				FileIdx.Add(count); count++;
			};
		} while(FindNextFile(fHandle,&amp;tmpData));
		FindClose(fHandle);
	};
	return FileList.GetSize();
};
int DIRINFO::innerComp(LPWIN32_FIND_DATA valOne,
			           LPWIN32_FIND_DATA valTwo, char idx)
{	int eStr,result = -1;
	FILETIME  *time1, *time2;
	char	  *p1, *p2;
	switch(idx)
	{	case 1: time1 = &amp;valOne-&gt;ftCreationTime;   time2 = &amp;valTwo-&gt;ftCreationTime;   break; 
		case 2: time1 = &amp;valOne-&gt;ftLastAccessTime; time2 = &amp;valTwo-&gt;ftLastAccessTime; break; 
		case 3: time1 = &amp;valOne-&gt;ftLastWriteTime;   time2 = &amp;valTwo-&gt;ftLastWriteTime;   break;
		case 8: p1 = valOne-&gt;cFileName; p2 = valTwo-&gt;cFileName; break;
		case 9: p1 = valOne-&gt;cAlternateFileName; p2 = valTwo-&gt;cAlternateFileName; break;
	};		

	switch(idx)
	{	case 1 :
		case 2 :
		case 3 :eStr = CompareFileTime(time1,time2);
				if(	 (eStr &gt; 0 &amp;&amp; !isDesc) ||
					 (eStr &lt; 0 &amp;&amp; isDesc) ) result = 2;
				else result = 1;	
				break;
		case 4 :
		case 5 :if(  (valOne-&gt;nFileSizeHigh &gt; valTwo-&gt;nFileSizeHigh &amp;&amp; !isDesc) ||
					(valOne-&gt;nFileSizeHigh &lt; valTwo-&gt;nFileSizeHigh &amp;&amp; isDesc) ) result = 2;
			    else if (valOne-&gt;nFileSizeHigh == valTwo-&gt;nFileSizeHigh)
                {	 if((valOne-&gt;nFileSizeLow &gt; valTwo-&gt;nFileSizeLow &amp;&amp; !isDesc) ||
					 (valOne-&gt;nFileSizeLow &lt; valTwo-&gt;nFileSizeLow &amp;&amp; isDesc) ) result = 2;
					 else result = 1;	
				}
				else result = 1;
				break;
		case 8:
		case 9:	eStr = strcmp(p1,p2);
				if(	 (eStr &gt; 0 &amp;&amp; !isDesc) ||
					 (eStr &lt; 0 &amp;&amp; isDesc) ) result = 2;
				else  result = 1;	
				break;

	};	
	return result;
};
</code></pre>
<p>eigentlich ist es ein 'einfaches' Bubblesort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f60b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_savoring_food"
      title=":yum:"
      alt="😋"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/819306</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819306</guid><dc:creator><![CDATA[rasi]]></dc:creator><pubDate>Tue, 28 Jun 2005 19:12:28 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 19:16:28 GMT]]></title><description><![CDATA[<p>rasi guck mal auf <a href="http://www.thedailywtf.com/" rel="nofollow">http://www.thedailywtf.com/</a> da wird code gesucht wie deiner.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819309</guid><dc:creator><![CDATA[*lol*]]></dc:creator><pubDate>Tue, 28 Jun 2005 19:16:28 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 20:34:45 GMT]]></title><description><![CDATA[<p>nun *lol* dann will ich mal hoffen, das Du den 'armen Schweinen' hilfst, die welche brauchen.ansonsten ...<br />
verstehe ich deinen Beitrag nicht recht.</p>
<p>ach ja *lol* versuch´s zu optimieren wenn Du kannst. Ein Verzeichnis mit 1000 - 2000 Dateien/Verzeichnisse muss nach allen Möglichkeiten die die Windowsfilestruktur hat auf Knopfdruck sortiert werden, das ganze hängt hinter einem HTTP-Server im LAN. was hier in dem Auschnitt noch fehlt, sind ein paar diverse Filter.<br />
und versuche es bitte nicht mit einem einfachen sort_stable() und vector(). Da sitzen ein paar Leute dahinter und erwarten eine Reaktionszeit die zwischen 1-2 Sekunden liegt.<br />
Und ja, solche 'dicken' Verzeichnisse sind Mist !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/819327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819327</guid><dc:creator><![CDATA[rasi]]></dc:creator><pubDate>Tue, 28 Jun 2005 20:34:45 GMT</pubDate></item><item><title><![CDATA[Reply to FindFirstFile - FindNextFile reihenfolge on Tue, 28 Jun 2005 22:26:12 GMT]]></title><description><![CDATA[<p>Hier etwas Hintergrundwissen zum Thema: <a href="http://blogs.msdn.com/oldnewthing/archive/2005/06/17/430194.aspx" rel="nofollow">http://blogs.msdn.com/oldnewthing/archive/2005/06/17/430194.aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/819408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/819408</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Tue, 28 Jun 2005 22:26:12 GMT</pubDate></item></channel></rss>