<?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[Einlesen von Textdatei als String macht Probleme]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte in meinem Programm eine lange Folge von Buchstaben aus einer Textdatei in einen String einlesen. Das Ganze habe ich mit 4 Dateien getestet und merkwürdigerweise werden 2 davon korrekt erkannt, während bei den anderen beiden nichts eingelesen wird (die Länge des String Objekts beträgt dann 0).<br />
Hier ist der Anfang von meinem Programm, der die betreffende Stelle enthält:</p>
<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;cmath&gt;
#include &lt;sstream&gt;

using namespace std;

string doubleToString(double d)
{
    stringstream ss;
    ss &lt;&lt; d;
    return ss.str();
} 

int main()
{
	string cipher = &quot;&quot;;
	int haeufigkeit [26];
	const double ENGLISH = 0.0667;
	const double GERMAN = 0.0767;
	const double TOLERANCE = 0.0045;
	double coincidence;					// current coincidence value
	int keylength = 1;
	double indices [10];				// list with indices of all substrings

	[b]ifstream input (&quot;aufgabe2.txt&quot;, ios::in);
		string temp;

		while(getline(input, temp)){
	//		cout &lt;&lt; &quot;Read&quot; &lt;&lt; endl;
            cipher += temp;
			cout &lt;&lt; temp &lt;&lt; endl;[/b]
		}
</code></pre>
<p>Bin für jeden Tipp dankbar, wo das Problem liegen könnte.</p>
<p>Grüße,</p>
<p>Neo777</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/265958/einlesen-von-textdatei-als-string-macht-probleme</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 14:30:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/265958.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 01 May 2010 18:24:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Einlesen von Textdatei als String macht Probleme on Sat, 01 May 2010 18:24:16 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich möchte in meinem Programm eine lange Folge von Buchstaben aus einer Textdatei in einen String einlesen. Das Ganze habe ich mit 4 Dateien getestet und merkwürdigerweise werden 2 davon korrekt erkannt, während bei den anderen beiden nichts eingelesen wird (die Länge des String Objekts beträgt dann 0).<br />
Hier ist der Anfang von meinem Programm, der die betreffende Stelle enthält:</p>
<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;cmath&gt;
#include &lt;sstream&gt;

using namespace std;

string doubleToString(double d)
{
    stringstream ss;
    ss &lt;&lt; d;
    return ss.str();
} 

int main()
{
	string cipher = &quot;&quot;;
	int haeufigkeit [26];
	const double ENGLISH = 0.0667;
	const double GERMAN = 0.0767;
	const double TOLERANCE = 0.0045;
	double coincidence;					// current coincidence value
	int keylength = 1;
	double indices [10];				// list with indices of all substrings

	[b]ifstream input (&quot;aufgabe2.txt&quot;, ios::in);
		string temp;

		while(getline(input, temp)){
	//		cout &lt;&lt; &quot;Read&quot; &lt;&lt; endl;
            cipher += temp;
			cout &lt;&lt; temp &lt;&lt; endl;[/b]
		}
</code></pre>
<p>Bin für jeden Tipp dankbar, wo das Problem liegen könnte.</p>
<p>Grüße,</p>
<p>Neo777</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1891025</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1891025</guid><dc:creator><![CDATA[Neo777]]></dc:creator><pubDate>Sat, 01 May 2010 18:24:16 GMT</pubDate></item><item><title><![CDATA[Reply to Einlesen von Textdatei als String macht Probleme on Tue, 04 May 2010 06:39:55 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::ifstream InFile(&quot;DeineDatei.txt&quot;);
std::string FileString;
std::getline(InFile, FileString, '\0');
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1892049</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1892049</guid><dc:creator><![CDATA[Blaze]]></dc:creator><pubDate>Tue, 04 May 2010 06:39:55 GMT</pubDate></item></channel></rss>