<?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[Mögliche Rückgabewerte von int main(int argc, char** argv)]]></title><description><![CDATA[<p>Ich hätte eine kleine dumme Frage.</p>
<p>Und zwar möchte ich ein Programm schreiben, welche unterschiedliche Rückgabewerte für die main Funktion hat. Und dabei möchte ich mich an sofern vorhandene Standard's halten. Doch leider weis ich diese nicht.</p>
<p>Was sollte also ein Programm zurückgeben, wenn ein Fehler aufgetaucht ist ?</p>
<pre><code class="language-cpp">int main(int argc, char** argv)
{
  ...
  if (error)
    return 0;
  ...
  return 1;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/227068/mögliche-rückgabewerte-von-int-main-int-argc-char-argv</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 07:55:17 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/227068.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 10 Nov 2008 13:19:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Mon, 10 Nov 2008 13:19:29 GMT]]></title><description><![CDATA[<p>Ich hätte eine kleine dumme Frage.</p>
<p>Und zwar möchte ich ein Programm schreiben, welche unterschiedliche Rückgabewerte für die main Funktion hat. Und dabei möchte ich mich an sofern vorhandene Standard's halten. Doch leider weis ich diese nicht.</p>
<p>Was sollte also ein Programm zurückgeben, wenn ein Fehler aufgetaucht ist ?</p>
<pre><code class="language-cpp">int main(int argc, char** argv)
{
  ...
  if (error)
    return 0;
  ...
  return 1;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1612719</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1612719</guid><dc:creator><![CDATA[Bitte ein Bit]]></dc:creator><pubDate>Mon, 10 Nov 2008 13:19:29 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Mon, 10 Nov 2008 13:29:26 GMT]]></title><description><![CDATA[<p>Standards gibt es da imho nicht (bitte korrigieren, wenn ich mich irre). Du solltest nur besser keine negativen Werte zurückgeben, da if errorlevel in batch-Dateien ja eine größer-gleich-Abfrage ist. if errorlevel -1 würde also auch zutreffen, wenn du 0 zurückgibst. Ich würde einfach durchnummerieren...</p>
<p>EDIT: Und gerade habe ich mir noch dein Beispiel angesehen! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> Du solltest im fehler<strong>freien</strong> Fall immer 0 zurückgeben. Fehler sind 1 aufwärts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1612728</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1612728</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 10 Nov 2008 13:29:26 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Mon, 10 Nov 2008 13:36:07 GMT]]></title><description><![CDATA[<p>_matze schrieb:</p>
<blockquote>
<p>Standards gibt es da imho nicht (bitte korrigieren, wenn ich mich irre).</p>
</blockquote>
<p>im standard gibts EXIT_SUCCESS und EXIT_FAILURE. ob's noch mehr davon gibt, weiss ich aber nicht.<br />
<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/1612739</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1612739</guid><dc:creator><![CDATA[~fricky]]></dc:creator><pubDate>Mon, 10 Nov 2008 13:36:07 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Mon, 10 Nov 2008 14:12:16 GMT]]></title><description><![CDATA[<p>~fricky schrieb:</p>
<blockquote>
<p>_matze schrieb:</p>
<blockquote>
<p>Standards gibt es da imho nicht (bitte korrigieren, wenn ich mich irre).</p>
</blockquote>
<p>im standard gibts EXIT_SUCCESS und EXIT_FAILURE. ob's noch mehr davon gibt, weiss ich aber nicht.<br />
<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>
</blockquote>
<p>Aber klar, jetzt wo du es sagst... <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/1612784</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1612784</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Mon, 10 Nov 2008 14:12:16 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Mon, 10 Nov 2008 20:32:06 GMT]]></title><description><![CDATA[<p>... wobei dies einfach 0 und 1 ist. Im Endeffekt gilt die Regel, je höher die Nummer desto &quot;größer&quot;der Fehler oder das Problem.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1612940</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1612940</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 10 Nov 2008 20:32:06 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Tue, 11 Nov 2008 07:29:44 GMT]]></title><description><![CDATA[<p>Danke für die Infos. <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>
<p>Dass mit dem Errorlevel hatte ich total vergessen. Und da ich ja mit dem Errorlevel arbeite, habe ich wohl einen Fehler in meinen Batch's.</p>
<p>Im Ganzen gefällt mir die Batch Programmierung immer weniger. Zuviele Dinge werden einfach schlecht unterstützt. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> Mal schauen ob ich nicht bald mal auf eine Skriptsprache ala VBS, JS, Perl, Python umsteige.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1613017</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1613017</guid><dc:creator><![CDATA[Bitte ein Bit]]></dc:creator><pubDate>Tue, 11 Nov 2008 07:29:44 GMT</pubDate></item><item><title><![CDATA[Reply to Mögliche Rückgabewerte von int main(int argc, char** argv) on Tue, 11 Nov 2008 09:01:08 GMT]]></title><description><![CDATA[<p>Powershell, oder einfach alle unzulänglichkeiten von normalen Batch Files hinter sich lassen:<br />
<a href="http://blog.m-ri.de/index.php/2008/06/22/abgespecktes-4nt-als-tccle-von-jp-software-als-freeware/" rel="nofollow">http://blog.m-ri.de/index.php/2008/06/22/abgespecktes-4nt-als-tccle-von-jp-software-als-freeware/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1613040</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1613040</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Tue, 11 Nov 2008 09:01:08 GMT</pubDate></item></channel></rss>