<?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[programmabsturtz trotz try-catch]]></title><description><![CDATA[<p>moin, ich versuche die autorun.inf einer cd zu lesen, und anschliessend die unter &quot;open&quot; eingetragene datei dieser cd zu öffnen, es funktioniert auch sofern eine cd im laufwerk liegt, die eine autorun.inf hat, ansonsonsten stürtzt mein programm ab.</p>
<pre><code class="language-cpp">CString sDatei = &quot;d:\\autorun.inf&quot;;
	CString s = &quot;&quot;;
	char cDaten[1024]; // ja, 1024 als puffer für ne autorun.inf ist übertrieben, na und mein rechner hat die ressourcen :-)
	cDaten[0] = NULL;
	//Autorun.inf öffnen
	try
	{
		CFile file;
		file.Open(sDatei,CFile::modeRead, NULL);
		file.Read(cDaten, 1024);
	}
	catch(CFileException *e)
	{
		e-&gt;Delete();
		//Es soll keine Warnung o.ä. ausgegeben werden
	}
	if(cDaten[0] != NULL)
	{
		s = cDaten;
		s.MakeLower();
		s.Delete(0, s.Find(&quot;open=&quot;, 0)+5); ///+5, da &quot;open=&quot; mitgelöscht werden soll
		s = s.Left(s.Find(&quot;\r&quot;, 0));
		sDatei.Format(&quot;d:\\%s&quot;, s);
		ShellExecute (NULL, &quot;open&quot;, sDatei , &quot;&quot;, NULL, SW_SHOWNORMAL);
	}
</code></pre>
<p>danke im vorraus</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/76015/programmabsturtz-trotz-try-catch</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 02:44:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/76015.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Jun 2004 07:24:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to programmabsturtz trotz try-catch on Mon, 07 Jun 2004 07:24:56 GMT]]></title><description><![CDATA[<p>moin, ich versuche die autorun.inf einer cd zu lesen, und anschliessend die unter &quot;open&quot; eingetragene datei dieser cd zu öffnen, es funktioniert auch sofern eine cd im laufwerk liegt, die eine autorun.inf hat, ansonsonsten stürtzt mein programm ab.</p>
<pre><code class="language-cpp">CString sDatei = &quot;d:\\autorun.inf&quot;;
	CString s = &quot;&quot;;
	char cDaten[1024]; // ja, 1024 als puffer für ne autorun.inf ist übertrieben, na und mein rechner hat die ressourcen :-)
	cDaten[0] = NULL;
	//Autorun.inf öffnen
	try
	{
		CFile file;
		file.Open(sDatei,CFile::modeRead, NULL);
		file.Read(cDaten, 1024);
	}
	catch(CFileException *e)
	{
		e-&gt;Delete();
		//Es soll keine Warnung o.ä. ausgegeben werden
	}
	if(cDaten[0] != NULL)
	{
		s = cDaten;
		s.MakeLower();
		s.Delete(0, s.Find(&quot;open=&quot;, 0)+5); ///+5, da &quot;open=&quot; mitgelöscht werden soll
		s = s.Left(s.Find(&quot;\r&quot;, 0));
		sDatei.Format(&quot;d:\\%s&quot;, s);
		ShellExecute (NULL, &quot;open&quot;, sDatei , &quot;&quot;, NULL, SW_SHOWNORMAL);
	}
</code></pre>
<p>danke im vorraus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/534786</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/534786</guid><dc:creator><![CDATA[Emperor_L0ser]]></dc:creator><pubDate>Mon, 07 Jun 2004 07:24:56 GMT</pubDate></item><item><title><![CDATA[Reply to programmabsturtz trotz try-catch on Mon, 07 Jun 2004 10:42:16 GMT]]></title><description><![CDATA[<p>Prüf doch den Rückgabewert von CFile::Open. Die Methode gibt FALSE zurück fals was schief ging, und dann führt jeder Leseversuch zum Absturz.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/534930</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/534930</guid><dc:creator><![CDATA[newvet]]></dc:creator><pubDate>Mon, 07 Jun 2004 10:42:16 GMT</pubDate></item><item><title><![CDATA[Reply to programmabsturtz trotz try-catch on Mon, 07 Jun 2004 10:45:33 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">s = cDaten;
</code></pre>
<p>ohne das jetzt genau zu wissen... ich würd spontan sagen das er das nicht mag weil cDaten nicht nullterminiert ist...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/534932</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/534932</guid><dc:creator><![CDATA[Windalf]]></dc:creator><pubDate>Mon, 07 Jun 2004 10:45:33 GMT</pubDate></item><item><title><![CDATA[Reply to programmabsturtz trotz try-catch on Mon, 07 Jun 2004 11:35:02 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1313">@newvet</a><br />
danke, es funktioniert wie gewollt</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/5110">@windalf</a><br />
ja, ich habe nachdem die datei zu ende ist jede menge müll im string stehen, das interessiert mich in dem Fall aber nicht, da der gesuchte teil davor ist. <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="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/534972</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/534972</guid><dc:creator><![CDATA[Emperor_L0ser]]></dc:creator><pubDate>Mon, 07 Jun 2004 11:35:02 GMT</pubDate></item></channel></rss>