<?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[terminate called after throwing an instance of]]></title><description><![CDATA[<blockquote>
<p>terminate called after throwing an instance of 'std::ios_base::failure'<br />
what(): basic_ios::clear<br />
Abgebrochen</p>
</blockquote>
<p>schafft es jemand mir diese Fehlermeldung zu erklären ohne den Code zu kennen?<br />
ich möchte es gerne verstehen.<br />
die Fehlermeldung kommt zur Laufzeit wodurch wird sie ausgelöst bzw. durch welchen Umstand kommt sie zustande?</p>
<p>thx miko</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/238873/terminate-called-after-throwing-an-instance-of</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 17:49:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/238873.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 16 Apr 2009 19:54:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to terminate called after throwing an instance of on Thu, 16 Apr 2009 19:54:05 GMT]]></title><description><![CDATA[<blockquote>
<p>terminate called after throwing an instance of 'std::ios_base::failure'<br />
what(): basic_ios::clear<br />
Abgebrochen</p>
</blockquote>
<p>schafft es jemand mir diese Fehlermeldung zu erklären ohne den Code zu kennen?<br />
ich möchte es gerne verstehen.<br />
die Fehlermeldung kommt zur Laufzeit wodurch wird sie ausgelöst bzw. durch welchen Umstand kommt sie zustande?</p>
<p>thx miko</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1696884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1696884</guid><dc:creator><![CDATA[miko]]></dc:creator><pubDate>Thu, 16 Apr 2009 19:54:05 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Thu, 16 Apr 2009 20:05:32 GMT]]></title><description><![CDATA[<p>eine möglichkeit: hast new vergessen.<br />
<a href="http://www.google.de/search?hl=de&amp;q=%22what%28%29%3A+basic_ios%3A%3Aclear%22&amp;meta=" rel="nofollow">http://www.google.de/search?hl=de&amp;q=&quot;what()%3A+basic_ios%3A%3Aclear&quot;&amp;meta=</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1696889</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1696889</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Thu, 16 Apr 2009 20:05:32 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Sat, 18 Apr 2009 08:47:43 GMT]]></title><description><![CDATA[<p>hier mal was ich zum testen geschrieben habe<br />
lasst es ruhig Kritik hageln. aber bitte erklärt mir warum ich hier eine eof exception bekomme. thx</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;fstream&gt;
#include &lt;exception&gt;

class file : public std::fstream
{
	public:
	std::string filename;
	file ( const char * filename, std::ios_base::openmode mode )
	: filename (std::string(filename))
	{
		std::cout &lt;&lt; &quot;open file &quot; &lt;&lt; filename &lt;&lt; '\n';
		/* kein oefbit */
		this-&gt;exceptions ( std::ios_base::failbit | std::ios_base::badbit );
		try {
			this-&gt;open ( filename, mode );
		} catch ( std::ios_base::failure e ) {
			std::cerr &lt;&lt; filename &lt;&lt; &quot;: &quot; &lt;&lt; e.what () &lt;&lt; '\n';
		}
	}
	~file ( void )
	{
		if ( this-&gt;is_open () )
			this-&gt;close ();
	}
};

int
process(std::ifstream&amp; in, std::ofstream&amp; out)
{
	char ch;
	try {
		while ( in.eof () == false ) {
			in.get(ch);
			out.put(ch);
		}

		return (EXIT_SUCCESS);
	} catch (ios_base::failure e) {
		std::cerr &lt;&lt; &quot;process: &quot; &lt;&lt; e.what () &lt;&lt; '\n';

		if (in.good () )
			std::cout &lt;&lt; &quot;good\n&quot;;
		/*else*/ if ( in.eof () )
			std::cout &lt;&lt; &quot;eof\n&quot;; /* eof wird dennoch geworfen !? */
		/*else*/ if (in.fail () )
			std::cout &lt;&lt; &quot;fail\n&quot;;
		/*else*/ if (in.bad () )
			std::cout &lt;&lt; &quot;bad\n&quot;;

		return (EXIT_FAILURE);
	}
}

int
main(int argc, char** argv)
{

	if (argc != 3) {
		std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0] &lt;&lt; &quot; &lt;InputFile&gt; &lt;OutputFile&gt;\n&quot;;
		exit (EXIT_FAILURE);
	}

	file fin  (argv[1], std::ios_base::binary|std::ios_base::in);
	file fout (argv[2], std::ios_base::binary|std::ios_base::out);

	if ( fin.is_open () == false || fout.is_open () == false )
		exit (EXIT_FAILURE);

	return (process(reinterpret_cast&lt;ifstream&amp;&gt;(fin),reinterpret_cast&lt;ofstream&amp;&gt;(fout)));
}
</code></pre>
<p>Edit: Kritik ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1697229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1697229</guid><dc:creator><![CDATA[miko]]></dc:creator><pubDate>Sat, 18 Apr 2009 08:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Fri, 17 Apr 2009 13:13:23 GMT]]></title><description><![CDATA[<p>Kritik</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1697255</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1697255</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Fri, 17 Apr 2009 13:13:23 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Fri, 17 Apr 2009 14:06:07 GMT]]></title><description><![CDATA[<p>lol.<br />
solange der reinterpret_cast da ist, schau ichs nicht weiter an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1697289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1697289</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 17 Apr 2009 14:06:07 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Fri, 17 Apr 2009 14:32:19 GMT]]></title><description><![CDATA[<p>Mal abgesehen, dass dein Konzept und Code grausam ist ...</p>
<blockquote>
<p>badbit: Error due to the failure of an input/output operation on the stream buffer.</p>
</blockquote>
<pre><code class="language-cpp">while ( in.eof () == false )
</code></pre>
<p>Ich glaube, es kann erst festgestellt werden, ob man am Ende einer Datei ist, nachdem man versucht hat, vom Stream zu lesen. D.h.</p>
<pre><code class="language-cpp">in.get(ch);
</code></pre>
<p>wirft eine Exception, da du sie vorher angeschaltet hast.</p>
<pre><code class="language-cpp">catch (ios_base::failure e) {
  std::cerr &lt;&lt; &quot;process: &quot; &lt;&lt; e.what () &lt;&lt; '\n';

  if (in.good () )
    std::cout &lt;&lt; &quot;good\n&quot;;
</code></pre>
<p>Kann das ueberhaupt jemals eintreten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1697308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1697308</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Fri, 17 Apr 2009 14:32:19 GMT</pubDate></item><item><title><![CDATA[Reply to terminate called after throwing an instance of on Sat, 18 Apr 2009 08:37:28 GMT]]></title><description><![CDATA[<p>nein das good kann, da eine execption eingetreten ist, logisch nicht wahr sein.<br />
auch die else if müssen nach if geändert werden, da ja theoretisch alles wahr sein könnten und dann auch angezeigt werden sollte.<br />
klar - beim 2mal seh ich es nun auch^^</p>
<p>@ volkard :1. wollte ich mal sehen ob es auch wirklich geht^^ und der Funktions &quot;aufruf&quot; spricht die parameter liste war mir so vorgegeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> da hab ich die Parameter so gelassen.</p>
<blockquote>
<p>C/C++ Code:<br />
while ( in.eof () == false )<br />
Ich glaube, es kann erst festgestellt werden, ob man am Ende einer Datei ist, nachdem man versucht hat, vom Stream zu lesen. D.h.<br />
C/C++ Code:<br />
in.get(ch);<br />
wirft eine Exception, da du sie vorher angeschaltet hast.</p>
</blockquote>
<p>hm ich teste doch auf -&gt; EOF erreicht -&gt; nein -&gt; lese -&gt; EOF erreicht -&gt; nein -&gt; lese ... geht das so nicht? Steht eof nicht am Beginn auf false?</p>
<blockquote>
<p>Mal abgesehen, dass dein <strong>Konzept</strong> und Code grausam ist ...</p>
</blockquote>
<p>ist das mit der klasse file zu grausam um darüber zu sprechen?<br />
ich wollte so zentral das öffnen von Dateien verwalten fehler anzeigen und vllt später auch das diese klasse einen dialog anzeigt der ein datei-auswahl enthält. dazu sollte dann ein zweiter konstrukter her.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1697629</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1697629</guid><dc:creator><![CDATA[miko]]></dc:creator><pubDate>Sat, 18 Apr 2009 08:37:28 GMT</pubDate></item></channel></rss>