<?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[Problem mit struct]]></title><description><![CDATA[<p>Hallo, kann mir bitte jemand weiterhelfen...<br />
Ich definiere einen Stuktur, kann aber nacher keine char Werte eingeben.</p>
<pre><code>struct Daten{
	char Name[5];
	int Alter;};

void main(){
	Daten meineDaten;
	meineDaten.Alter=20;
	meineDaten.Name=&quot;Anna&quot;;
	cout&lt;&lt;meineDaten.Name&lt;&lt;endl;
	cout&lt;&lt;meineDaten.Alter&lt;&lt;endl;}
</code></pre>
<p>Der Fehler den er mir angibt ist:</p>
<p>error C2440: '=': 'const char [5]' kann nicht in 'char [5]' konvertiert werden</p>
<p>Was kann ich machen?<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/121605/problem-mit-struct</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 19:14:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/121605.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Sep 2005 18:13:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 18:13:05 GMT]]></title><description><![CDATA[<p>Hallo, kann mir bitte jemand weiterhelfen...<br />
Ich definiere einen Stuktur, kann aber nacher keine char Werte eingeben.</p>
<pre><code>struct Daten{
	char Name[5];
	int Alter;};

void main(){
	Daten meineDaten;
	meineDaten.Alter=20;
	meineDaten.Name=&quot;Anna&quot;;
	cout&lt;&lt;meineDaten.Name&lt;&lt;endl;
	cout&lt;&lt;meineDaten.Alter&lt;&lt;endl;}
</code></pre>
<p>Der Fehler den er mir angibt ist:</p>
<p>error C2440: '=': 'const char [5]' kann nicht in 'char [5]' konvertiert werden</p>
<p>Was kann ich machen?<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879897</guid><dc:creator><![CDATA[almendra]]></dc:creator><pubDate>Sun, 25 Sep 2005 18:13:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 18:30:58 GMT]]></title><description><![CDATA[<p>Du solltest das Problem mit strcpy lösen:</p>
<p>#include &lt;string.h&gt;</p>
<p>struct PLAYER<br />
{<br />
char Name[10];<br />
};</p>
<p>void main()<br />
{<br />
PLAYER p;<br />
strcpy(<a href="http://p.Name" rel="nofollow">p.Name</a>, &quot;Fred&quot;;<br />
}</p>
<p>Pass aber unbedint AUF !!! das der NAME nicht GRÖßER als dein Arry ist --&gt; Sonst Bufferoverflow</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879919</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sun, 25 Sep 2005 18:30:58 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 18:32:41 GMT]]></title><description><![CDATA[<p>Tc++H schrieb:</p>
<blockquote>
<p>Du solltest das Problem mit strcpy lösen:</p>
<p>#include &lt;string.h&gt;</p>
<p>struct PLAYER<br />
{<br />
char Name[10];<br />
};</p>
<p>void main()<br />
{<br />
PLAYER p;<br />
strcpy(<a href="http://p.Name" rel="nofollow">p.Name</a>, &quot;Fred&quot;;<br />
}</p>
<p>Pass aber unbedint AUF !!! das der NAME nicht GRÖßER als dein Arry ist --&gt; Sonst Bufferoverflow</p>
</blockquote>
<p>oder nimm strncpy.<br />
Oder wenns zur wahl steht std::string statt char[]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879923</guid><dc:creator><![CDATA[shapeless]]></dc:creator><pubDate>Sun, 25 Sep 2005 18:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 18:36:52 GMT]]></title><description><![CDATA[<p>Was isn der unterschied zwischen strncpy &amp; strcpy ???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879927</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879927</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Sun, 25 Sep 2005 18:36:52 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 19:21:11 GMT]]></title><description><![CDATA[<p>Tc++H schrieb:</p>
<blockquote>
<p>Was isn der unterschied zwischen strncpy &amp; strcpy ???</p>
</blockquote>
<p><a href="http://www.cppreference.com/stdstring/strncpy.html" rel="nofollow">char *strncpy( char *to, const char *from, size_t count )</a> != <a href="http://www.cppreference.com/stdstring/strcpy.html" rel="nofollow">char *strcpy( char *to, const char *from )</a></p>
<p>Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879954</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Sun, 25 Sep 2005 19:21:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Sun, 25 Sep 2005 19:23:04 GMT]]></title><description><![CDATA[<p>Vielen Dank,<br />
es hat funktioniert.<br />
Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879964</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879964</guid><dc:creator><![CDATA[almendra]]></dc:creator><pubDate>Sun, 25 Sep 2005 19:23:04 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit struct on Mon, 26 Sep 2005 05:15:27 GMT]]></title><description><![CDATA[<p>Ich mag Stringroutinen nicht so sonderlich, ABER man kommt einfach nicht drum, ist auch gut so.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880121</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880121</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Mon, 26 Sep 2005 05:15:27 GMT</pubDate></item></channel></rss>