<?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[OpenFileDialog und FILE]]></title><description><![CDATA[<p>Hallo,<br />
folgendes Problem:<br />
Ich hab ein Programm geschrieben, das in der Konsole einen Dateinamen und -Pfad abfragt und die entsprechende Datei zur weiteren Verwendung öffnet.<br />
Bisherige Version:</p>
<pre><code>char File1Name[255];
FILE* File1

printf(&quot;Quelldatei...: &quot;);
scanf(&quot;%s&quot;, File1Name);

if( (File1  = fopen(File1Name, &quot;r&quot; )) == NULL )
{
	printf( &quot;\nFehlgeschlagen!\n&quot; );
	goto ended;
}
</code></pre>
<p>Funktioniert soweit tadellos und tut anschließend seine Aufgabe.</p>
<p>Nun wurde der Auftrag allerdings erweitert und ich muss den Dateinamen per Dialogfenster abfragen.<br />
Bisher folgender Stand:</p>
<pre><code>OpenFileDialog *openFileDialog1 = new OpenFileDialog();
FILE *File1;
char File1Name[255];

if(openFileDialog1-&gt;ShowDialog()==::DialogResult::OK)
        [b]//Dieser Abschnitt fehlt[/b]

if( (File1  = fopen(File1Name, &quot;r&quot; )) == NULL )
{
	printf( &quot;\nFehlgeschlagen!&quot; );
	goto ended;
}
</code></pre>
<p>Nun hänge ich seit zwei Tagen an dem fehlenden Stück, das den Dateinamen aus dem <em>OpenFileDialog</em> in den für <em>fopen</em> nötigen <em>char[]</em> umwandelt.</p>
<p>Hab schon allen möglichen Unsinn durchprobiert. Allerdings ist meine Erfahrung noch sehr klein.<br />
Wäre sehr dankbar, wenn jemand eine Idee hätte.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/147349/openfiledialog-und-file</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 03:32:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/147349.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 May 2006 07:52:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 07:56:12 GMT]]></title><description><![CDATA[<p>Hallo,<br />
folgendes Problem:<br />
Ich hab ein Programm geschrieben, das in der Konsole einen Dateinamen und -Pfad abfragt und die entsprechende Datei zur weiteren Verwendung öffnet.<br />
Bisherige Version:</p>
<pre><code>char File1Name[255];
FILE* File1

printf(&quot;Quelldatei...: &quot;);
scanf(&quot;%s&quot;, File1Name);

if( (File1  = fopen(File1Name, &quot;r&quot; )) == NULL )
{
	printf( &quot;\nFehlgeschlagen!\n&quot; );
	goto ended;
}
</code></pre>
<p>Funktioniert soweit tadellos und tut anschließend seine Aufgabe.</p>
<p>Nun wurde der Auftrag allerdings erweitert und ich muss den Dateinamen per Dialogfenster abfragen.<br />
Bisher folgender Stand:</p>
<pre><code>OpenFileDialog *openFileDialog1 = new OpenFileDialog();
FILE *File1;
char File1Name[255];

if(openFileDialog1-&gt;ShowDialog()==::DialogResult::OK)
        [b]//Dieser Abschnitt fehlt[/b]

if( (File1  = fopen(File1Name, &quot;r&quot; )) == NULL )
{
	printf( &quot;\nFehlgeschlagen!&quot; );
	goto ended;
}
</code></pre>
<p>Nun hänge ich seit zwei Tagen an dem fehlenden Stück, das den Dateinamen aus dem <em>OpenFileDialog</em> in den für <em>fopen</em> nötigen <em>char[]</em> umwandelt.</p>
<p>Hab schon allen möglichen Unsinn durchprobiert. Allerdings ist meine Erfahrung noch sehr klein.<br />
Wäre sehr dankbar, wenn jemand eine Idee hätte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058624</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058624</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 07:56:12 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 07:58:32 GMT]]></title><description><![CDATA[<p>OpenFileDialog ist auf jedenfall erstmal kein Standard-C++, muss von einer Lib kommen, die mir aber nich geläufig ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>meist haben solche Klassen Funktionen wie OpenFileDialog::GetFilename() oder sowas, also du musst das Objekt nach dem ausgewählten Dateionamen fragen. DAnn kannst du weitermachen wie bisher</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058627</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Tue, 16 May 2006 07:58:32 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 08:37:24 GMT]]></title><description><![CDATA[<p>So weit war ich einem der Fehlversuche bereits:</p>
<pre><code>File1Name = openFileDialog1-&gt;get_FileName();
</code></pre>
<blockquote>
<p>error C2440: '=' : 'System::String __gc *' kann nicht in 'char [255]' konvertiert werden</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1058633</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058633</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 08:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 08:46:29 GMT]]></title><description><![CDATA[<p>Ein blankes Array kann auch nicht per = zugewiesen werden. Also entweder du verwendest einen Pointer auf die Daten, die dir der Dialog gibt oder du überträgst sie per strcpy() in dein Array.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058644</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 16 May 2006 08:46:29 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 08:51:24 GMT]]></title><description><![CDATA[<p>Was dann in Code wie aussähe?</p>
<p>NACHTRAG:</p>
<pre><code>strcpy(File1Name, openFileDialog1-&gt;get_FileName());
</code></pre>
<pre><code>error C2664: 'strcpy' : Konvertierung des Parameters 2 von 'System::String __gc *' in 'const char *' nicht möglich
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1058646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058646</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 08:51:24 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 08:57:29 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>du hast immer noch nicht gesagt, mit welcher externen Bibliothel du arbeitest.<br />
OpenFileDialog ist kein Teil des C++Standards!</p>
<p>Die Fehlermeldung deutet darauf hin, das die vom Dialog verwendete String-Klasse nicht impliziet in einen C-String umzuwandeln ist. Die meisten String-Klassen bieten dafür Methoden an, die das erledigen. Meistens heißen die <em>c_str()</em>.</p>
<p>Das weiterraten hier kannst du aber nur beenden, wenn du oben genannte Frage beantwortest.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058655</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058655</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 16 May 2006 08:57:29 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 09:06:05 GMT]]></title><description><![CDATA[<p>Bittesehr<br />
<a href="http://msdn2.microsoft.com/de-de/library/system.windows.forms.filedialog.aspx" rel="nofollow">http://msdn2.microsoft.com/de-de/library/system.windows.forms.filedialog.aspx</a></p>
<p>Wo genau ich die get_FileName Funktion her hab, kann ich ncihtmal sagen. Kann auhc aus den Hilfedateien kommen</p>
<p>Entwicklungsumgebuing ist Visual C++ mit .NET Framework 1.0<br />
Jahrgang 2001/2002 scheinbar. Was neueres haben die hier nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058664</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 09:06:05 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 09:08:51 GMT]]></title><description><![CDATA[<p>&quot;System::String __gc*&quot; klingt irgendwie nach einem .NET System.</p>
<p>*in der MSDN nachschlägt*<br />
Im Schnelldurchlauf finde ich nur die Methode <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstringclasscopytotopic.asp" rel="nofollow">CopyTo()</a>, die eventuell passen könnte.</p>
<p>(zum Thema wchar_t -&gt; char findest du nebenan einen Beitrag)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058666</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 16 May 2006 09:08:51 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 09:30:12 GMT]]></title><description><![CDATA[<blockquote>
<p>error C2664: 'System::String::CopyTo' : Konvertierung des Parameters 2 von 'System::String __gc *' in '__wchar_t __gc[]' nicht möglich</p>
</blockquote>
<p>Das macht mich langsam echt sauer. Den zweiten Tag fummel ich nun schon an dieser einen kleinen Ecke.</p>
<p>Gibts evtl. ne andere Alternative, um den Nutzer die Datei grafisch wählen zu lassen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058683</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 09:30:12 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 10:50:36 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=403" rel="nofollow">HumeSikkins</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=1" rel="nofollow">MFC (Visual C++)</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058756</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Tue, 16 May 2006 10:50:36 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 10:55:21 GMT]]></title><description><![CDATA[<p>Wenn Du die MFC verwendest, dann mit CFileDialog. Der ist IMHO Teil der comctl32.ocx (o.ä.? *etwas unsicher*) müsste sich so also auch über ActiveX einbinden lassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058763</guid><dc:creator><![CDATA[connan]]></dc:creator><pubDate>Tue, 16 May 2006 10:55:21 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 10:55:43 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/110">@HumeSikkins</a>: C++/CLI ist zwei Etagen tiefer <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><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6943">@Paddy</a>: Entweder du verzichtest komplett auf fopen() etc. und nutzt neuere File-Klassen der .NET Umgebung - oder du nimmst einen <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cfiledialog.asp" rel="nofollow">CFileDialog</a> aus der MFC - dessen GetPathName() Methode liefert einen CString, der eine automatische Konvertierung nach TCHAR* anbietet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058767</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 16 May 2006 10:55:43 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Tue, 16 May 2006 12:22:03 GMT]]></title><description><![CDATA[<p>EDIT:</p>
<p>Ok, bin weiter und habs geschafft, den Pfad in die char-Variable einzulesen.</p>
<blockquote>
<p>MailFinder Gold Console -v2 error LNK2005: &quot;void __cdecl operator delete(void *)&quot; (??3@YAXPAX@Z) bereits in LIBCMTD.lib(dbgdel.obj) definiert</p>
</blockquote>
<p>Zuviele includes, usings whatever?</p>
<pre><code>#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;string.h&gt;
#include &lt;iostream&gt;
#include &lt;afxdlgs.h&gt;
#using &lt;mscorlib.dll&gt;
#using &lt;system.dll&gt;
#using &lt;system.windows.forms.dll&gt;
using namespace std;
using namespace System::Windows::Forms;
using namespace System;
#include &quot;mailfuncts.h&quot;
</code></pre>
<p>Das ist das Ergebnis der Experimente mit vorhergehenden Schritten. Ist mit Sicherheit nicht sehr ordentlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1058800</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1058800</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Tue, 16 May 2006 12:22:03 GMT</pubDate></item><item><title><![CDATA[Reply to OpenFileDialog und FILE on Wed, 17 May 2006 07:05:22 GMT]]></title><description><![CDATA[<p>Ok, die Reihenfolge der Einträge machts aus. Wenn ich die &lt;afxdlgs.h&gt; auskommentiere (und natürlich allen Code, der Dinge daraus verwendet), dann läuft er durch.</p>
<p>Laut Microsoft Hilfeseite kann man über bestimmte Linkereinstellungen eine Verarbeitung in korrekter Reihenfolge erzwingen. Leider beziehen sich die Leute auf eine andere Version und mir fehlt das Dialogfeld dazu. Es belibt also nur umsortieren.</p>
<p>Vieleicht rettet mich einer davor, alle Kombinationen von Hand durch zu testen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1059261</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1059261</guid><dc:creator><![CDATA[PaddyShadow]]></dc:creator><pubDate>Wed, 17 May 2006 07:05:22 GMT</pubDate></item></channel></rss>