<?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[Problem mit WinApi FTP Funktion]]></title><description><![CDATA[<pre><code class="language-cpp">void upload(char *server, char *account, char *passwort)
{
    HINTERNET hOpen, hConnection;

    hOpen = InternetOpen(&quot;FTP Upload&quot;, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

    hConnection = InternetConnect(hOpen, server, INTERNET_DEFAULT_FTP_PORT,
                                     account, passwort, INTERNET_SERVICE_FTP, 0, 0);

    FtpPutFile(hConnection, &quot;C:\\dateiname&quot;, &quot;//dateiname&quot;,
                  FTP_TRANSFER_TYPE_BINARY, 0);

    InternetCloseHandle(hConnection);
    InternetCloseHandle(hOpen);
}
</code></pre>
<p>Also das ist meine Funktion zum &quot;uppen&quot; einer Datei. Nun ist der Dateiname in form eines Strings vorhanden. Da ich bei der Funktion aber keine Stringvariable eingeben kann, sondern explizit einen String eingeben muss, denke ich, dass ich das mit dem WinApi-Pendant des klassischen C++-Strings lösen muss. Wenn nicht, wie könnte ich das sonst lösen? Bin für Vorschläge offen...</p>
<p>Gruß skully</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/242527/problem-mit-winapi-ftp-funktion</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Apr 2026 04:27:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/242527.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Jun 2009 18:35:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 18:35:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">void upload(char *server, char *account, char *passwort)
{
    HINTERNET hOpen, hConnection;

    hOpen = InternetOpen(&quot;FTP Upload&quot;, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

    hConnection = InternetConnect(hOpen, server, INTERNET_DEFAULT_FTP_PORT,
                                     account, passwort, INTERNET_SERVICE_FTP, 0, 0);

    FtpPutFile(hConnection, &quot;C:\\dateiname&quot;, &quot;//dateiname&quot;,
                  FTP_TRANSFER_TYPE_BINARY, 0);

    InternetCloseHandle(hConnection);
    InternetCloseHandle(hOpen);
}
</code></pre>
<p>Also das ist meine Funktion zum &quot;uppen&quot; einer Datei. Nun ist der Dateiname in form eines Strings vorhanden. Da ich bei der Funktion aber keine Stringvariable eingeben kann, sondern explizit einen String eingeben muss, denke ich, dass ich das mit dem WinApi-Pendant des klassischen C++-Strings lösen muss. Wenn nicht, wie könnte ich das sonst lösen? Bin für Vorschläge offen...</p>
<p>Gruß skully</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721323</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Thu, 04 Jun 2009 18:35:00 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 19:04:33 GMT]]></title><description><![CDATA[<p>Kannst Du Deine Frage auch so formulieren, dass man es versteht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721340</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721340</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Thu, 04 Jun 2009 19:04:33 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 19:45:33 GMT]]></title><description><![CDATA[<p>lol du musst ein A an die Funktionen hängen, InternetOpen, InternetConnectA <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721368</guid><dc:creator><![CDATA[Pokerface]]></dc:creator><pubDate>Thu, 04 Jun 2009 19:45:33 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 19:47:05 GMT]]></title><description><![CDATA[<p>Öhhhh, Du kannst ohne weiteres so etwas machen:</p>
<pre><code class="language-cpp">void upload(char *server, char *account, char *passwort)
{

TCHAR dat1[] = &quot;c:\\dateiname&quot;;
TCHAR dat2[] = &quot;//dateiname&quot;;

[...]

    FtpPutFile(hConnection, dat1, dat2,
                  FTP_TRANSFER_TYPE_BINARY, 0);

[...]

}
</code></pre>
<p>... falls Du das überhaupt gemeint hast ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721370</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721370</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Thu, 04 Jun 2009 19:47:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 19:47:47 GMT]]></title><description><![CDATA[<p>machs lieber mit dem A, is besser. bei belli knallts trotzdem noch in InternetOpen^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721371</guid><dc:creator><![CDATA[rul0r]]></dc:creator><pubDate>Thu, 04 Jun 2009 19:47:47 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Thu, 04 Jun 2009 19:48:22 GMT]]></title><description><![CDATA[<p>Sorry, es muß natürlich:</p>
<p>TCHAR dat1[] = TEXT(&quot;c:\\dateiname&quot;);<br />
TCHAR dat2[] = TEXT(&quot;//dateiname&quot;);</p>
<p>heißen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721372</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Thu, 04 Jun 2009 19:48:22 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Fri, 05 Jun 2009 00:18:50 GMT]]></title><description><![CDATA[<p>Jochen Kalmbach schrieb:</p>
<blockquote>
<p>Kannst Du Deine Frage auch so formulieren, dass man es versteht?</p>
</blockquote>
<p>Sorry, ich merke grad selber... Also...</p>
<p>Nehmen wir an ich habe einen C++ String. Der C++ String hat den Namen &quot;Dateiname&quot;. Dateiname ist initialisiert mit &quot;C:\\Users&quot;. Dann habe ich eine WinApi Funktion, die als 2. und 3. Argument jeweils den <strong>WERT</strong> eines Strings erwartet:</p>
<p><strong>Funktioniert:</strong></p>
<pre><code class="language-cpp">FtpPutFile(hConnection, &quot;C:\\dateiname&quot;, &quot;//dateiname&quot;,
                  FTP_TRANSFER_TYPE_BINARY, 0);
</code></pre>
<p><strong>Funktioniert nicht:</strong></p>
<pre><code class="language-cpp">FtpPutFile(hConnection, Dateiname, &quot;//dateiname&quot;,
                  FTP_TRANSFER_TYPE_BINARY, 0);
</code></pre>
<p>Ich möchte den INHALT des Strings &quot;Dateiname&quot; als Argumente an die Funktion übergeben. Wie?<br />
------------------------------------------------------------------------------</p>
<p>Belli schrieb:</p>
<blockquote>
<p>Öhhhh, Du kannst ohne weiteres so etwas machen:</p>
<pre><code class="language-cpp">void upload(char *server, char *account, char *passwort)
{

TCHAR dat1[] = &quot;c:\\dateiname&quot;;
TCHAR dat2[] = &quot;//dateiname&quot;;

[...]

    FtpPutFile(hConnection, dat1, dat2,
                  FTP_TRANSFER_TYPE_BINARY, 0);

[...]

}
</code></pre>
<p>... falls Du das überhaupt gemeint hast ...</p>
</blockquote>
<p>Wie konvertiere ich einen C++ String in eine WinApi TCHAR?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721482</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721482</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Fri, 05 Jun 2009 00:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Fri, 05 Jun 2009 00:33:02 GMT]]></title><description><![CDATA[<p>Mit C++ String meinst du wohl std::string. Dann guck dir mal die Methode c_str an...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1721483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1721483</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Fri, 05 Jun 2009 00:33:02 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sat, 06 Jun 2009 17:32:57 GMT]]></title><description><![CDATA[<p>_matze schrieb:</p>
<blockquote>
<p>Mit C++ String meinst du wohl std::string. Dann guck dir mal die Methode c_str an...</p>
</blockquote>
<p>Das macht daraus eine C-Char, richtig?</p>
<p>Funktioniert das dann auch mit WinApi-Zeichenketten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722396</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Sat, 06 Jun 2009 17:32:57 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sat, 06 Jun 2009 18:21:37 GMT]]></title><description><![CDATA[<p>skullyan schrieb:</p>
<blockquote>
<p>Funktioniert das dann auch mit WinApi-Zeichenketten?</p>
</blockquote>
<p>Was sind WinAPI-Zeichenketten??</p>
<p>Das funktioniert mit allen Funktionen, die halt einen C-String (char*) erwarten, was bei den meisten WinAPI-Funktionen der Fall ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722420</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722420</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Sat, 06 Jun 2009 18:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sun, 07 Jun 2009 14:18:43 GMT]]></title><description><![CDATA[<p>_matze schrieb:</p>
<blockquote>
<p>skullyan schrieb:</p>
<blockquote>
<p>Funktioniert das dann auch mit WinApi-Zeichenketten?</p>
</blockquote>
<p>Was sind WinAPI-Zeichenketten??</p>
<p>Das funktioniert mit allen Funktionen, die halt einen C-String (char*) erwarten, was bei den meisten WinAPI-Funktionen der Fall ist.</p>
</blockquote>
<p>Ich dachte so nennt man die TCHAR's. Ich werde es probieren, sobald ich zuhause bin! Danke für den Vorschlag.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722752</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Sun, 07 Jun 2009 14:18:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sun, 07 Jun 2009 18:06:27 GMT]]></title><description><![CDATA[<p>Habe versucht, <code>std::string</code> mittels <code>c_str()</code> zu konvertieren. Dabei kam das raus:</p>
<p><strong>Deklaration der Funktion:</strong></p>
<pre><code class="language-cpp">void upload(char *newname);
</code></pre>
<p><strong>Funktion in main():</strong></p>
<pre><code class="language-cpp">std::string newname;

// [...]

upload(newname.c_str());
</code></pre>
<p><strong>WinApi Funktion:</strong></p>
<pre><code class="language-cpp">void upload(char *server, char *account, char *passwort, char *newname)
{
    HINTERNET hOpen, hConnection;

    hOpen = InternetOpen(&quot;FTP Upload&quot;, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

    hConnection = InternetConnect(hOpen, server, INTERNET_DEFAULT_FTP_PORT,
                                     account, passwort, INTERNET_SERVICE_FTP, 0, 0);

    FtpPutFile(hConnection, newname, &quot;//Dateiname&quot;,
                  FTP_TRANSFER_TYPE_BINARY, 0);

    InternetCloseHandle(hConnection);
    InternetCloseHandle(hOpen);
}
</code></pre>
<p><strong>DER FEHLER:</strong></p>
<pre><code>error C2664: 'upload': Konvertierung des Parameters 4 von 'const char *' in 'char *' nicht möglich
Durch die Konvertierung gehen Qualifizierer verloren
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1722901</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722901</guid><dc:creator><![CDATA[skullyan]]></dc:creator><pubDate>Sun, 07 Jun 2009 18:06:27 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sun, 07 Jun 2009 18:11:55 GMT]]></title><description><![CDATA[<p>jo einmal hirn anschalten und nochmal versuchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1722906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722906</guid><dc:creator><![CDATA[entnervt0r]]></dc:creator><pubDate>Sun, 07 Jun 2009 18:11:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit WinApi FTP Funktion on Sun, 07 Jun 2009 20:58:15 GMT]]></title><description><![CDATA[<p>skullyan schrieb:</p>
<blockquote>
<p>[/cpp]</p>
<p><strong>WinApi Funktion:</strong></p>
<p>[cpp]void upload(<strong>const</strong> char *server, <strong>const</strong> char *account, <strong>const</strong> char *passwort, <strong>const</strong> char *newname)</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1722986</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1722986</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sun, 07 Jun 2009 20:58:15 GMT</pubDate></item></channel></rss>