<?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[Eingabe in einem struct in Verbindung mit einem String]]></title><description><![CDATA[<p>Hallo alle zusammen,<br />
ich habe folgendes Problem:</p>
<p>Ich würde gerne in meinem struct arikel pulver 3 Sachen eingeben. Bei Eingaben vom Typ int ist das kein Problem. Allerdings bei einem String klappt das bei mir nicht so richtig. Ich habe hier im Codebeispiel jetzt einfach &quot;iwas&quot; drinnen stehen. Mit</p>
<pre><code>cin.getline(pulver.beschreibung, sizeof(pulver.beschreibung)
</code></pre>
<p>hat es leider nicht geklappt.</p>
<p>Hier der code dafür:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

struct artikel
{
	int sachnummer;
	char bezeichnung[100];
	int anzahl;
};

int main()
{
	struct artikel pulver;
	cout &lt;&lt; &quot;Sachnummer: &quot;;
	cin &gt;&gt; pulver.sachnummer;
	cout &lt;&lt; &quot;Bezeichnung &quot;;
	&lt;&lt;&lt;&lt; Hier soll die Eingabe rein &gt;&gt;&gt;&gt;strncpy_s(pulver.bezeichnung, &quot;iwas&quot;, sizeof(pulver.bezeichnung)-1);
	cout &lt;&lt; &quot;Anzahl&quot;;
	cin &gt;&gt; pulver.anzahl;

	cout &lt;&lt; pulver.sachnummer &lt;&lt; endl &lt;&lt; pulver.bezeichnung &lt;&lt; endl &lt;&lt; pulver.anzahl &lt;&lt; endl;
	system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/336984/eingabe-in-einem-struct-in-verbindung-mit-einem-string</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 15:14:05 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/336984.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Feb 2016 16:51:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eingabe in einem struct in Verbindung mit einem String on Sun, 28 Feb 2016 16:51:08 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,<br />
ich habe folgendes Problem:</p>
<p>Ich würde gerne in meinem struct arikel pulver 3 Sachen eingeben. Bei Eingaben vom Typ int ist das kein Problem. Allerdings bei einem String klappt das bei mir nicht so richtig. Ich habe hier im Codebeispiel jetzt einfach &quot;iwas&quot; drinnen stehen. Mit</p>
<pre><code>cin.getline(pulver.beschreibung, sizeof(pulver.beschreibung)
</code></pre>
<p>hat es leider nicht geklappt.</p>
<p>Hier der code dafür:</p>
<pre><code>#include &lt;iostream&gt;

using namespace std;

struct artikel
{
	int sachnummer;
	char bezeichnung[100];
	int anzahl;
};

int main()
{
	struct artikel pulver;
	cout &lt;&lt; &quot;Sachnummer: &quot;;
	cin &gt;&gt; pulver.sachnummer;
	cout &lt;&lt; &quot;Bezeichnung &quot;;
	&lt;&lt;&lt;&lt; Hier soll die Eingabe rein &gt;&gt;&gt;&gt;strncpy_s(pulver.bezeichnung, &quot;iwas&quot;, sizeof(pulver.bezeichnung)-1);
	cout &lt;&lt; &quot;Anzahl&quot;;
	cin &gt;&gt; pulver.anzahl;

	cout &lt;&lt; pulver.sachnummer &lt;&lt; endl &lt;&lt; pulver.bezeichnung &lt;&lt; endl &lt;&lt; pulver.anzahl &lt;&lt; endl;
	system(&quot;PAUSE&quot;);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2488907</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2488907</guid><dc:creator><![CDATA[DubiTG]]></dc:creator><pubDate>Sun, 28 Feb 2016 16:51:08 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabe in einem struct in Verbindung mit einem String on Sun, 28 Feb 2016 17:22:24 GMT]]></title><description><![CDATA[<p>nimm std::string, dann gehts wie bei dem int</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2488908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2488908</guid><dc:creator><![CDATA[KN4CK3R]]></dc:creator><pubDate>Sun, 28 Feb 2016 17:22:24 GMT</pubDate></item><item><title><![CDATA[Reply to Eingabe in einem struct in Verbindung mit einem String on Sun, 28 Feb 2016 17:33:59 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct artikel pulver;
</code></pre>
<p>So muss man das in C schreiben. Womit versuchst du, C++ zu lernen? Besorg dir anständiges Lehrmaterial, sonst lernst du nur Müll!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2488909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2488909</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 28 Feb 2016 17:33:59 GMT</pubDate></item></channel></rss>