<?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[link aus textdatei lesen und runterladen]]></title><description><![CDATA[<p>Hallo,</p>
<p>eigentlich will ich eine datei, die mir eine textdatei runterlädt, einen einzeiligen link einliest und die datei dann in ein temporäres verzeichnis runterladen.<br />
Kann mir bitte jemand helfen? Normales herunterladen kriege ich hin, aber ich kann den link nicht von einer datei einlesen und verwenden =/...</p>
<pre><code>std::wstring inside;
		ifstream infile;
		infile.open(loadme);
		while (!infile.eof) 
		{
			getline(infile, inside); 
			std::wstring url4(L&quot;&quot;); 

			std::wstring loadme = env(_TEXT(&quot;TEMP&quot;)); 
			loadme += (L&quot;\\test\\file.exe&quot;);

			url4 += inside.c_str(); 
			HRESULT hr2 = URLDownloadToFile(NULL, (url4.c_str()), (loadme.c_str()), 0, NULL); //Download-Start
		}
		infile.close();
		system(&quot;pause&quot;);
</code></pre>
<pre><code>1&gt;------ Erstellen gestartet: Projekt: load, Konfiguration: Debug Win32 ------
1&gt;  stdafx.cpp
1&gt;  load.cpp
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(44): error C2276: &quot;!&quot;: Ungültige Operation auf Ausdruck einer gebundenen Memberfunktion
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2784: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Argument für &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;&quot; konnte nicht von &quot;std::ifstream&quot; hergeleitet werden.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(157): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2782: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Parameter &quot;_Elem&quot; ist mehrdeutig.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(157): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: kann &quot;wchar_t&quot; sein
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: oder &quot;char&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2780: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;,const _Elem)&quot;: Erwartet 3 Argumente - 2 unterstützt
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(146): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2784: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Argument für &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;&quot; konnte nicht von &quot;std::ifstream&quot; hergeleitet werden.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(126): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2782: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Parameter &quot;_Elem&quot; ist mehrdeutig.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(126): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: kann &quot;wchar_t&quot; sein
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: oder &quot;char&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2780: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;,const _Elem)&quot;: Erwartet 3 Argumente - 2 unterstützt
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(73): note: Siehe Deklaration von &quot;std::getline&quot;
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========
</code></pre>
<p>Vielen Dank für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/335154/link-aus-textdatei-lesen-und-runterladen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 23:41:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/335154.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Nov 2015 21:51:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to link aus textdatei lesen und runterladen on Mon, 02 Nov 2015 21:51:14 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>eigentlich will ich eine datei, die mir eine textdatei runterlädt, einen einzeiligen link einliest und die datei dann in ein temporäres verzeichnis runterladen.<br />
Kann mir bitte jemand helfen? Normales herunterladen kriege ich hin, aber ich kann den link nicht von einer datei einlesen und verwenden =/...</p>
<pre><code>std::wstring inside;
		ifstream infile;
		infile.open(loadme);
		while (!infile.eof) 
		{
			getline(infile, inside); 
			std::wstring url4(L&quot;&quot;); 

			std::wstring loadme = env(_TEXT(&quot;TEMP&quot;)); 
			loadme += (L&quot;\\test\\file.exe&quot;);

			url4 += inside.c_str(); 
			HRESULT hr2 = URLDownloadToFile(NULL, (url4.c_str()), (loadme.c_str()), 0, NULL); //Download-Start
		}
		infile.close();
		system(&quot;pause&quot;);
</code></pre>
<pre><code>1&gt;------ Erstellen gestartet: Projekt: load, Konfiguration: Debug Win32 ------
1&gt;  stdafx.cpp
1&gt;  load.cpp
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(44): error C2276: &quot;!&quot;: Ungültige Operation auf Ausdruck einer gebundenen Memberfunktion
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2784: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Argument für &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;&quot; konnte nicht von &quot;std::ifstream&quot; hergeleitet werden.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(157): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2782: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Parameter &quot;_Elem&quot; ist mehrdeutig.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(157): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: kann &quot;wchar_t&quot; sein
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: oder &quot;char&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2780: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;,const _Elem)&quot;: Erwartet 3 Argumente - 2 unterstützt
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(146): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2784: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Argument für &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;&quot; konnte nicht von &quot;std::ifstream&quot; hergeleitet werden.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(126): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2782: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;)&quot;: template-Parameter &quot;_Elem&quot; ist mehrdeutig.
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(126): note: Siehe Deklaration von &quot;std::getline&quot;
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: kann &quot;wchar_t&quot; sein
1&gt;  e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): note: oder &quot;char&quot;
1&gt;e:\programmierung\c++\youtubetraining\load\load\load.cpp(46): error C2780: &quot;std::basic_istream&lt;_Elem,_Traits&gt; &amp;std::getline(std::basic_istream&lt;_Elem,_Traits&gt; &amp;&amp;,std::basic_string&lt;_Elem,_Traits,_Alloc&gt; &amp;,const _Elem)&quot;: Erwartet 3 Argumente - 2 unterstützt
1&gt;  c:\program files (x86)\microsoft visual studio 14.0\vc\include\string(73): note: Siehe Deklaration von &quot;std::getline&quot;
========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ==========
</code></pre>
<p>Vielen Dank für die Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2473878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2473878</guid><dc:creator><![CDATA[LoadFile]]></dc:creator><pubDate>Mon, 02 Nov 2015 21:51:14 GMT</pubDate></item><item><title><![CDATA[Reply to link aus textdatei lesen und runterladen on Mon, 02 Nov 2015 21:59:42 GMT]]></title><description><![CDATA[<p>Zeile 44 die Klammern hinter <code>eof</code> vergessen und dann kannst du auch nicht so einfach die wide strings mit den normalen streams nutzen. Entweder <code>std::string</code> nutzen oder <code>std::wifstream</code> für die Datei.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2473880</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2473880</guid><dc:creator><![CDATA[sebi707]]></dc:creator><pubDate>Mon, 02 Nov 2015 21:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to link aus textdatei lesen und runterladen on Mon, 02 Nov 2015 22:07:02 GMT]]></title><description><![CDATA[<p>Ich würde getline als Bedingung für die while Schleife nehmen:</p>
<pre><code>while (getline(...))
{
    ...
}
</code></pre>
<p>Ich weiß auch nicht was in deinem speziellen Fall ist, aber normalerweise sollte man auch sicherstellen dass die Eingabe gültig ist, bevor man sie verarbeitet.</p>
<p>Ich kenne mich auch nicht wirklich in dem Gebiet aus, aber beliebig websites downloaded von links in txt files hört sich für mich nach Sicherheitsrisiko an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2473882</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2473882</guid><dc:creator><![CDATA[HarteWare]]></dc:creator><pubDate>Mon, 02 Nov 2015 22:07:02 GMT</pubDate></item><item><title><![CDATA[Reply to link aus textdatei lesen und runterladen on Mon, 02 Nov 2015 22:14:52 GMT]]></title><description><![CDATA[<p>risiken und absicherungen sind in dem umfeld nicht wichtig. es soll einfach nur die datei laden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2473883</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2473883</guid><dc:creator><![CDATA[LoadFile]]></dc:creator><pubDate>Mon, 02 Nov 2015 22:14:52 GMT</pubDate></item><item><title><![CDATA[Reply to link aus textdatei lesen und runterladen on Mon, 02 Nov 2015 22:33:50 GMT]]></title><description><![CDATA[<p>inhalt von loadme.txt:<br />
<a href="http://seite.de/TeamSpeak3-Client-win64-3.0.18.exe" rel="nofollow">http://seite.de/TeamSpeak3-Client-win64-3.0.18.exe</a></p>
<pre><code>&lt;überdermain&gt;
std::wstring s2ws(const std::string&amp; s)
{
	int len;
	int slength = (int)s.length() + 1;
	len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
	wchar_t* buf = new wchar_t[len];
	MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
	std::wstring r(buf);
	delete[] buf;
	return r;
}
&lt;/überdermain&gt;
main...

	std::string inside;
	ifstream infile;
	infile.open(loadme);
	while (!infile.eof()) 
	{
		getline(infile, inside); 
		std::string url4(&quot;&quot;); 
		std::wstring loadme = env(_TEXT(&quot;Temp&quot;)); //TempOrdner
		loadme += (L\\test\\file.exe&quot;);
		url4 += inside; 
		std::wstring stemp = s2ws(url4);
		LPCWSTR result = stemp.c_str();
		HRESULT hr2 = URLDownloadToFile(NULL, (result), (loadme.c_str()), 0, NULL); //Download-Start
	}
	infile.close();
return 0;
</code></pre>
<p>Funktioniert<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2473884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2473884</guid><dc:creator><![CDATA[LoadFile]]></dc:creator><pubDate>Mon, 02 Nov 2015 22:33:50 GMT</pubDate></item></channel></rss>