<?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[Logik Problem. Hat jmd ne Idee???]]></title><description><![CDATA[<p>Hallo<br />
ich schreibe gerade an einem Programm, womit ich einen Ordner öffne und dann über die einzelnen Bilder ieteriere um im testfall die Namen der Bilder in ein File schreibe...<br />
Folgendes Problem. Ich habe einen Button: All bei dem der Ordner geöffnet wird. das Fubnktioniert fein und der Pfad wird in m_path gespeichert. Damit arbeite ich jetz weiter....</p>
<p>Der Button Process soll jetzt die arbeit machen. Um</p>
<pre><code class="language-cpp">void CtestDlg::onProcess () 
{
CString sDefault = &quot;nichts&quot;;
std::ofstream out (&quot;myresults.txt&quot;); //File öffnen

while (m_fileName.Compare(sDefault)  // solange der Ordner nicht leer ist 
{
  m_fileName = getFilename (m_path);  // Funktionszugriff auf getFilename
  proc = new Imageprocessor (m_fileName); // für spätere Anwendung relevant
  if (proc!= 0)
  {
    result = m_fileName; // Testweise den Filename in die Datei speichern
    out &lt;&lt; result ;
  }
}
}
</code></pre>
<p>Meine Funktion getFilename sieht so aus:</p>
<pre><code class="language-cpp">CString CtestDlg::getFilename (CString nextdir)
{ 
CString sFilePath;
CFileFind finder;
CString curdir = nextdir;
CString finaldir;
Cstring name;
bool bIterator = finder.FindFile(curdir+ &quot;\\*.*&quot;);

while (bIterator &gt; O) 
{
  bIterator = finder.FindNextFile();
  name = finder.GetFileName();
  if (name == &quot;.&quot; || name == &quot;..&quot;) {}
  else 
   if (finder.IsDirectors()!= 0) 
   {
    nextdir = curdir + &quot;\\&quot; + name;
    getFilename (nextdir);
   }
   else 
   {
    sFilePath = finder.GetFilePath();
    return sFilePath;
   }
}
CString sDefault = &quot;nichts&quot;;
return sDefault;
finder.Close();
}
</code></pre>
<p>So. das Problem ist, dass ich ja immer wieder in das GetFilename gehe, um dort meinen Pfad herzubekommen....<br />
Und der Pfad ist offensichtlich ja immer der selbe, weil die Stelle wo der Iterator ist nicht gespeichert wird.<br />
Wie kann ich das lösen??<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/142031/logik-problem-hat-jmd-ne-idee</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 02:13:20 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/142031.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Mar 2006 13:53:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 13:53:16 GMT]]></title><description><![CDATA[<p>Hallo<br />
ich schreibe gerade an einem Programm, womit ich einen Ordner öffne und dann über die einzelnen Bilder ieteriere um im testfall die Namen der Bilder in ein File schreibe...<br />
Folgendes Problem. Ich habe einen Button: All bei dem der Ordner geöffnet wird. das Fubnktioniert fein und der Pfad wird in m_path gespeichert. Damit arbeite ich jetz weiter....</p>
<p>Der Button Process soll jetzt die arbeit machen. Um</p>
<pre><code class="language-cpp">void CtestDlg::onProcess () 
{
CString sDefault = &quot;nichts&quot;;
std::ofstream out (&quot;myresults.txt&quot;); //File öffnen

while (m_fileName.Compare(sDefault)  // solange der Ordner nicht leer ist 
{
  m_fileName = getFilename (m_path);  // Funktionszugriff auf getFilename
  proc = new Imageprocessor (m_fileName); // für spätere Anwendung relevant
  if (proc!= 0)
  {
    result = m_fileName; // Testweise den Filename in die Datei speichern
    out &lt;&lt; result ;
  }
}
}
</code></pre>
<p>Meine Funktion getFilename sieht so aus:</p>
<pre><code class="language-cpp">CString CtestDlg::getFilename (CString nextdir)
{ 
CString sFilePath;
CFileFind finder;
CString curdir = nextdir;
CString finaldir;
Cstring name;
bool bIterator = finder.FindFile(curdir+ &quot;\\*.*&quot;);

while (bIterator &gt; O) 
{
  bIterator = finder.FindNextFile();
  name = finder.GetFileName();
  if (name == &quot;.&quot; || name == &quot;..&quot;) {}
  else 
   if (finder.IsDirectors()!= 0) 
   {
    nextdir = curdir + &quot;\\&quot; + name;
    getFilename (nextdir);
   }
   else 
   {
    sFilePath = finder.GetFilePath();
    return sFilePath;
   }
}
CString sDefault = &quot;nichts&quot;;
return sDefault;
finder.Close();
}
</code></pre>
<p>So. das Problem ist, dass ich ja immer wieder in das GetFilename gehe, um dort meinen Pfad herzubekommen....<br />
Und der Pfad ist offensichtlich ja immer der selbe, weil die Stelle wo der Iterator ist nicht gespeichert wird.<br />
Wie kann ich das lösen??<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1024819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1024819</guid><dc:creator><![CDATA[Forza]]></dc:creator><pubDate>Mon, 27 Mar 2006 13:53:16 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 14:36:10 GMT]]></title><description><![CDATA[<p>sorry, aber es ist echt dringend... ich komme einfach nicht weiter !</p>
<p>HHHIIIILLLLFFFEEE !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1024851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1024851</guid><dc:creator><![CDATA[Forza]]></dc:creator><pubDate>Mon, 27 Mar 2006 14:36:10 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 14:40:50 GMT]]></title><description><![CDATA[<p>So etwas geht in C++ nicht. Wegen der Rekursion würde dir auch eine statische Variable nicht helfen. In .NET 2.0 könntest du das mit yield machen.</p>
<p>Schreib die Funktion so um, dass sie eine Liste füllt, und iteriere hinterher über diese Liste.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1024853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1024853</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 27 Mar 2006 14:40:50 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 18:25:48 GMT]]></title><description><![CDATA[<p>Und wie mache ich das am besten? kannst du mir vielleicht helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1025013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1025013</guid><dc:creator><![CDATA[Forza]]></dc:creator><pubDate>Mon, 27 Mar 2006 18:25:48 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 18:58:16 GMT]]></title><description><![CDATA[<p>Forza schrieb:</p>
<blockquote>
<p>Und wie mache ich das am besten?</p>
</blockquote>
<p>Mach's erst mal so, dass es geht. Um Optimierungen kannst du dich später kümmern.</p>
<blockquote>
<p>kannst du mir vielleicht helfen?</p>
</blockquote>
<p>Wo ist konkret das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1025069</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1025069</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 27 Mar 2006 18:58:16 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 19:14:40 GMT]]></title><description><![CDATA[<p>wie speicher ich die Sachen am Besten? In einem Array, oder in einem Vektor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1025079</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1025079</guid><dc:creator><![CDATA[Forza]]></dc:creator><pubDate>Mon, 27 Mar 2006 19:14:40 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 19:17:49 GMT]]></title><description><![CDATA[<p>In einem Vector, weil du vorher nicht weißt, wie viele es werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1025080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1025080</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 27 Mar 2006 19:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to Logik Problem. Hat jmd ne Idee??? on Mon, 27 Mar 2006 19:34:06 GMT]]></title><description><![CDATA[<p>ok, ich probiers mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1025086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1025086</guid><dc:creator><![CDATA[Forza]]></dc:creator><pubDate>Mon, 27 Mar 2006 19:34:06 GMT</pubDate></item></channel></rss>