<?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[Ifstrem&#x2F;Infile Text wird nicht eingelesen]]></title><description><![CDATA[<p>hallo, ich bin neu hier</p>
<p>zz geh ich in die 3te Klasse einer HTL für EDVO und habe dieses Jahr C++ und will nu meine Hausaufgabe machen und stehe vor dem Problem, das ich aus einer Datei nichts einlesen kann, hab die SUFU schon verwendet aber das hat mir leider nichts gebracht</p>
<p>ich arbeite mit Mircrosoft Visual Studio 2005</p>
<pre><code class="language-cpp">void main(void)
{
	char a[4];							//für charakters mit 3 Buchstaben
	/*ifstream infile;
	ofstream outfile;
	outfile.open(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;,ios::app);
	outfile.close();
	infile.open(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;, ifstream::in);
	infile.getline (a, 4); */
	std::ifstream file(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;); 
    file.unsetf(std::ios_base::skipws); 
	std::string s((std::istream_iterator&lt;char&gt;(file)), std::istream_iterator&lt;char&gt;());
	cout&lt;&lt;file&lt;&lt;endl;
	cout&lt;&lt;h(konvert(file))&lt;&lt;endl;
//	infile.close();
	system(&quot;Pause&quot;);

}
</code></pre>
<p>in der Textdatei stehen Zeilenweise 3 Buchstaben<br />
Abc<br />
Def<br />
Ghi usw...</p>
<p>weder das sdt:ifstream noch das ifstream infile liefern mir irgendeinen dieser Charakter (die in meinem Textdokument stehen), weis da evtl wer weiter?</p>
<p>(bei cout&lt;&lt;a; und cout&lt;&lt;file; kommt nichts raus (oder 0000000) )</p>
<p>(die Konvert funktion konvertiert den string in eine Zahl und die h Funktion macht die Zahl % (mod) 23)</p>
<p>auch wenn nichts rauskommt kommt dann halt die fehlermeldung</p>
<pre><code>Fehler	4	error C2664: 'konvert': Konvertierung des Parameters 1 von 'std::ifstream' in 'char *' nicht möglich	c:\Users\Christoph\Documents\Visual Studio 2005\Projects\hash-ADAT\hash-ADAT\hash.cpp	25
</code></pre>
<p>da is es mir klar das es nicht Konvertiert werden kann, aber jedoch brauch ich das dann schon im Konvert</p>
<p>LG und danke schon im vorraus Fanati_c</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/255933/ifstrem-infile-text-wird-nicht-eingelesen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 19:02:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/255933.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Dec 2009 18:44:10 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ifstrem&#x2F;Infile Text wird nicht eingelesen on Sat, 05 Dec 2009 18:44:10 GMT]]></title><description><![CDATA[<p>hallo, ich bin neu hier</p>
<p>zz geh ich in die 3te Klasse einer HTL für EDVO und habe dieses Jahr C++ und will nu meine Hausaufgabe machen und stehe vor dem Problem, das ich aus einer Datei nichts einlesen kann, hab die SUFU schon verwendet aber das hat mir leider nichts gebracht</p>
<p>ich arbeite mit Mircrosoft Visual Studio 2005</p>
<pre><code class="language-cpp">void main(void)
{
	char a[4];							//für charakters mit 3 Buchstaben
	/*ifstream infile;
	ofstream outfile;
	outfile.open(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;,ios::app);
	outfile.close();
	infile.open(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;, ifstream::in);
	infile.getline (a, 4); */
	std::ifstream file(&quot;C:\Users\Christoph\Documents\Namen.txt&quot;); 
    file.unsetf(std::ios_base::skipws); 
	std::string s((std::istream_iterator&lt;char&gt;(file)), std::istream_iterator&lt;char&gt;());
	cout&lt;&lt;file&lt;&lt;endl;
	cout&lt;&lt;h(konvert(file))&lt;&lt;endl;
//	infile.close();
	system(&quot;Pause&quot;);

}
</code></pre>
<p>in der Textdatei stehen Zeilenweise 3 Buchstaben<br />
Abc<br />
Def<br />
Ghi usw...</p>
<p>weder das sdt:ifstream noch das ifstream infile liefern mir irgendeinen dieser Charakter (die in meinem Textdokument stehen), weis da evtl wer weiter?</p>
<p>(bei cout&lt;&lt;a; und cout&lt;&lt;file; kommt nichts raus (oder 0000000) )</p>
<p>(die Konvert funktion konvertiert den string in eine Zahl und die h Funktion macht die Zahl % (mod) 23)</p>
<p>auch wenn nichts rauskommt kommt dann halt die fehlermeldung</p>
<pre><code>Fehler	4	error C2664: 'konvert': Konvertierung des Parameters 1 von 'std::ifstream' in 'char *' nicht möglich	c:\Users\Christoph\Documents\Visual Studio 2005\Projects\hash-ADAT\hash-ADAT\hash.cpp	25
</code></pre>
<p>da is es mir klar das es nicht Konvertiert werden kann, aber jedoch brauch ich das dann schon im Konvert</p>
<p>LG und danke schon im vorraus Fanati_c</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1818341</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1818341</guid><dc:creator><![CDATA[Fanati_C]]></dc:creator><pubDate>Sat, 05 Dec 2009 18:44:10 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstrem&#x2F;Infile Text wird nicht eingelesen on Sat, 05 Dec 2009 18:55:50 GMT]]></title><description><![CDATA[<p>Das liegt daran das die daten schon in &quot;s&quot; stehen in dem string. Du versuchst aber mit dem filestream zu arbeiten der schon am dateiende angekommen ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1818347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1818347</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Sat, 05 Dec 2009 18:55:50 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstrem&#x2F;Infile Text wird nicht eingelesen on Sat, 05 Dec 2009 21:29:48 GMT]]></title><description><![CDATA[<p>supi, danke funktioniert nun, hab dann noch nen #include &lt;string&gt; gemacht und alles haut hin</p>
<p>hab ab dem nu ziemlich alles dann selbst herausgefunden steh aber nun vor nem problem wobei ich das problem aber nicht sehe</p>
<pre><code class="language-cpp">void main(void)
{
	ifstream f( &quot;C:\\Users\\Christoph\\Documents\\Namen.txt&quot; );
	string s;
	getline( f, s );
	cout&lt;&lt;s&lt;&lt;endl;
	//getline(f,s);
	//cout&lt;&lt;s&lt;&lt;endl;

	cout&lt;&lt;h(konvert(s))&lt;&lt;endl;
	f.close();
	system(&quot;Pause&quot;);

}

int konvert(string name)
{
	std::stringstream sstr(name);
	int Zahl;
	sstr &gt;&gt; Zahl;
	return Zahl;

};
</code></pre>
<p>und als fehler:</p>
<pre><code>Fehler	1	error C2664: 'konvert': Konvertierung des Parameters 1 [b]von 'std::string' in 'std::string *[/b]' nicht möglich	c:\Users\Christoph\Documents\Visual Studio 2005\Projects\hash-ADAT\hash-ADAT\hash.cpp	24
</code></pre>
<p>den fehler überblick ich überhaupt nicht</p>
<p>hoffe mir kann wer helfen</p>
<p>danke <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1818391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1818391</guid><dc:creator><![CDATA[Fanati_C]]></dc:creator><pubDate>Sat, 05 Dec 2009 21:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstrem&#x2F;Infile Text wird nicht eingelesen on Sun, 06 Dec 2009 02:33:06 GMT]]></title><description><![CDATA[<p><code>std::stringstream sstr(name);</code> den konstruktor gibt es nicht</p>
<p>-&gt;</p>
<pre><code class="language-cpp">std::stringstream ss;
ss &lt;&lt; name;
int r;
ss &gt;&gt; r;
return r;
</code></pre>
<p>btw: such mal nach &quot;call by value&quot; bzw &quot;call by reference&quot;... strings übergibt man üblicherweise nicht by value ;o)</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1818471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1818471</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Sun, 06 Dec 2009 02:33:06 GMT</pubDate></item></channel></rss>