<?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[strcpy]]></title><description><![CDATA[<p>Hallo, ich bin noch Anfänger in C++ und habe ein Problem wo ich einfach nicht weiterkomme.</p>
<p>Ich habe global die Struktur:</p>
<p>struct daten<br />
{<br />
char roemisch[5];<br />
int dezimal;<br />
};</p>
<p>deklariert. Im main habe ich dann eine Zeichenkette in den char der Struktur geschrieben.</p>
<p>struct daten datensaetze[2];</p>
<p>strcpy(datensaetze[0].roemisch,&quot;CXVI&quot;);</p>
<p>Beim kompilieren werden keine Fehler angezeigt, aber wenn ich das Programm ausführe kommt ein Problembericht (Windows hat ein Problem festgestellt...)</p>
<p>Als ich das Programm ohne struct daten datensaetze[2]; ausgeführt habe kam kein Problembericht mehr.</p>
<p>Was kann ich da falsch gemacht haben.</p>
<p>Ich bin für jede Antwort dankbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/182716/strcpy</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 00:29:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/182716.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 May 2007 14:10:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 14:10:09 GMT]]></title><description><![CDATA[<p>Hallo, ich bin noch Anfänger in C++ und habe ein Problem wo ich einfach nicht weiterkomme.</p>
<p>Ich habe global die Struktur:</p>
<p>struct daten<br />
{<br />
char roemisch[5];<br />
int dezimal;<br />
};</p>
<p>deklariert. Im main habe ich dann eine Zeichenkette in den char der Struktur geschrieben.</p>
<p>struct daten datensaetze[2];</p>
<p>strcpy(datensaetze[0].roemisch,&quot;CXVI&quot;);</p>
<p>Beim kompilieren werden keine Fehler angezeigt, aber wenn ich das Programm ausführe kommt ein Problembericht (Windows hat ein Problem festgestellt...)</p>
<p>Als ich das Programm ohne struct daten datensaetze[2]; ausgeführt habe kam kein Problembericht mehr.</p>
<p>Was kann ich da falsch gemacht haben.</p>
<p>Ich bin für jede Antwort dankbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293791</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293791</guid><dc:creator><![CDATA[Reptile100]]></dc:creator><pubDate>Mon, 28 May 2007 14:10:09 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 15:10:02 GMT]]></title><description><![CDATA[<p>Also das hier funktioniert bei mir fehlerlos:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstring&gt;
using namespace std;

struct daten
{
    char roemisch[5];
    int dezimal;
};

int main()
{
    struct daten datensaetze[2];
    strcpy(datensaetze[0].roemisch,&quot;CXVI&quot;);
    cout &lt;&lt; datensaetze[0].roemisch &lt;&lt; endl;

    return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1293835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293835</guid><dc:creator><![CDATA[Stromberg]]></dc:creator><pubDate>Mon, 28 May 2007 15:10:02 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 15:52:28 GMT]]></title><description><![CDATA[<p>C++?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;cstring&gt;

struct data
{
    char roman[5];
    int  decimal;
};

int main()
{
    data datensaetze[2];
    strcpy(datensaetze[0].roman, &quot;CXVI&quot;);
    std::cout &lt;&lt; datensaetze[0].roman &lt;&lt; std::endl;
}
</code></pre>
<p>... aber sonnst sollte das echt io gehen ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293874</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293874</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 28 May 2007 15:52:28 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 16:47:56 GMT]]></title><description><![CDATA[<p>Wenn ich das in einem neuen Projekt auf eure Weise mache funktioniert das.</p>
<p>Ich hab hier mal das ganze Programm:</p>
<p>#include&lt;stdlib.h&gt;<br />
#include&lt;stdio.h&gt;<br />
#include&lt;cstring&gt;<br />
#include&lt;iostream&gt;<br />
using namespace std;</p>
<p>struct daten<br />
{<br />
char roemisch[5];</p>
<p>int dezimal;<br />
};</p>
<p>int speichern()<br />
{</p>
<p>FILE *datei_speichern;</p>
<p>if((datei_speichern=fopen(&quot;datensaetze.txt&quot;,&quot;wb&quot;))!=NULL)<br />
{</p>
<p>fprintf(datei_speichern,&quot;puffer&quot;);</p>
<p>}<br />
else<br />
{<br />
printf(&quot;Datei konnte nicht geöffnet werden&quot;);</p>
<p>}</p>
<p>fclose(datei_speichern);</p>
<p>return 0;</p>
<p>}</p>
<p>main()<br />
{</p>
<p>struct daten datensaetze[2];</p>
<p>strcpy(datensaetze[0].roemisch,&quot;CXVI&quot;);<br />
datensaetze[0].dezimal=119;</p>
<p>strcpy(datensaetze[1].roemisch,&quot;CXXV&quot;);<br />
datensaetze[1].dezimal=103;</p>
<p>strcpy(datensaetze[2].roemisch,&quot;CVXX&quot;);<br />
datensaetze[2].dezimal=147;</p>
<p>speichern();</p>
<p>return 0;<br />
}</p>
<p>Ich hab im Laufe des Tages immer mehr vom ganzen Programm herausgenommen um Stück für Stück voranzukommen. Das Programm ist so noch nicht fertig, ich möchte nur dass das erstmal soweit funktioniert.</p>
<p>Später möchte ich dann alle datensaetze an das Unterprogramm speichern übergeben und mit fwrite abspeichern. Aber da hatte ich auch immer einen Fehler, den ich nicht beheben konnte.</p>
<p>Danke für die schnellen Antworten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293919</guid><dc:creator><![CDATA[Reptile100]]></dc:creator><pubDate>Mon, 28 May 2007 16:47:56 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 17:00:50 GMT]]></title><description><![CDATA[<p>@Reptil<br />
benutz bitte Code-Tags sfds</p>
<p>Das Problem liegt daran, das <code>T foo[N]</code> exakt N Elemente anlegt. Du legst also _2_ Elemente an und versuchst auf _3_ Elemente zuzugreifen. Das geht sich natürlich nicht aus!</p>
<p>@(D)Evil<br />
dann bitte auch std::strcpy</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293927</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Mon, 28 May 2007 17:00:50 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Mon, 28 May 2007 17:11:59 GMT]]></title><description><![CDATA[<p>Oh man, was fürn blöder Fehler - danke, darauf wär ich so schnell nicht gekommen.<br />
Ich dachte, dass es da auch bei 0 beginnt.</p>
<p>Nächstes Mal werd ich die syntaxcoloring benutzen.</p>
<p>Nochmals danke für die schnelle Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1293948</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1293948</guid><dc:creator><![CDATA[Reptile100]]></dc:creator><pubDate>Mon, 28 May 2007 17:11:59 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Tue, 29 May 2007 00:19:25 GMT]]></title><description><![CDATA[<p>std::ofstream ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1294135</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1294135</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 29 May 2007 00:19:25 GMT</pubDate></item><item><title><![CDATA[Reply to strcpy on Tue, 29 May 2007 04:31:30 GMT]]></title><description><![CDATA[<p>Reptile100 schrieb:</p>
<blockquote>
<p>Oh man, was fürn blöder Fehler - danke, darauf wär ich so schnell nicht gekommen.<br />
Ich dachte, dass es da auch bei 0 beginnt.</p>
<p>Nächstes Mal werd ich die syntaxcoloring benutzen.</p>
<p>Nochmals danke für die schnelle Antwort.</p>
</blockquote>
<p><code>T foo[N]</code> legt ein Feld mit N Elementen im Bereich 0 bis einschließlich N-1 an <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/1294149</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1294149</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Tue, 29 May 2007 04:31:30 GMT</pubDate></item></channel></rss>