<?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 For-Schleife]]></title><description><![CDATA[<p>Hallo ihrs,</p>
<p>ich hab derzeit praktikum und programmiere mit VC++ 2008 von MS ein DB-Programm mit Tcp-client/Server.</p>
<p>nun soll das DataSet vom server in Strings umgewandelt werden, diese dann in byte-arrauy und ab in den Stream damit. das meiste wird durch for-schleifen realisiert. jedoch ist nun das problem, dass die for-schleifen übersprungen werden, alles andere klappt.</p>
<p>hier der Code:</p>
<pre><code>for (int a = 1; a == anzahlrows; a++)
					 {
						 DataRow^ row = zwischentable-&gt;Rows[a];
						 for (rowspalte = 2; rowspalte == 9; rowspalte++)
						 {
							 data = nullptr;
							 if (row[rowspalte]-&gt;ToString() != &quot;&quot;)
							 {
								 data = row[rowspalte]-&gt;ToString();
								 array&lt;Byte&gt;^ msg = System::Text::Encoding::ASCII-&gt;GetBytes(data);
								 array&lt;Byte&gt;^ msgantw = nullptr;
								 stream-&gt;Write(msg, 0, msg-&gt;Length);
								 bool erfolg = false;
								 while (erfolg == false)
								 {
									 Int32 bytes = stream-&gt;Read(msgantw, 0, msgantw-&gt;Length);
									 String^ dataantw = System::Text::Encoding::ASCII-&gt;GetString(msgantw, 0, bytes);
									 if (dataantw == &quot;Empfangen&quot;)
									 {
										 erfolg = true;
									 }
								 }
							 }
							 else
							 {
								 data = &quot;leer&quot;;
								 array&lt;Byte&gt;^ msg = System::Text::Encoding::ASCII-&gt;GetBytes(data);
								 array&lt;Byte&gt;^ msgantw2 = nullptr;
								 stream-&gt;Write(msg, 0, msg-&gt;Length);
								 bool erfolg2 = false;
								 while (erfolg2 = false)
								 {
									 Int32 bytes = stream-&gt;Read(msgantw2, 0, msgantw2-&gt;Length);
									 String^ dataantw2 = System::Text::Encoding::ASCII-&gt;GetString(msgantw2, 0, bytes);
									 if (dataantw2 == &quot;Empfangen&quot;)
									 {
										 erfolg2 = true;
									 }
								 }
							 }
						 }
						 dssent = dssent + 1;
					 }
</code></pre>
<p>alle vorher gesetzten variablen die in dem Code-teil hier nicht deklariert sind, wurden im programm weiter oden deklariert und initialisiert.</p>
<p>hoffe ihr erkennt evtl den fehler...</p>
<p>mfg Poppkins</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/229744/problem-mit-for-schleife</link><generator>RSS for Node</generator><lastBuildDate>Sun, 27 Sep 2026 17:26:41 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/229744.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Dec 2008 10:05:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 10:05:06 GMT]]></title><description><![CDATA[<p>Hallo ihrs,</p>
<p>ich hab derzeit praktikum und programmiere mit VC++ 2008 von MS ein DB-Programm mit Tcp-client/Server.</p>
<p>nun soll das DataSet vom server in Strings umgewandelt werden, diese dann in byte-arrauy und ab in den Stream damit. das meiste wird durch for-schleifen realisiert. jedoch ist nun das problem, dass die for-schleifen übersprungen werden, alles andere klappt.</p>
<p>hier der Code:</p>
<pre><code>for (int a = 1; a == anzahlrows; a++)
					 {
						 DataRow^ row = zwischentable-&gt;Rows[a];
						 for (rowspalte = 2; rowspalte == 9; rowspalte++)
						 {
							 data = nullptr;
							 if (row[rowspalte]-&gt;ToString() != &quot;&quot;)
							 {
								 data = row[rowspalte]-&gt;ToString();
								 array&lt;Byte&gt;^ msg = System::Text::Encoding::ASCII-&gt;GetBytes(data);
								 array&lt;Byte&gt;^ msgantw = nullptr;
								 stream-&gt;Write(msg, 0, msg-&gt;Length);
								 bool erfolg = false;
								 while (erfolg == false)
								 {
									 Int32 bytes = stream-&gt;Read(msgantw, 0, msgantw-&gt;Length);
									 String^ dataantw = System::Text::Encoding::ASCII-&gt;GetString(msgantw, 0, bytes);
									 if (dataantw == &quot;Empfangen&quot;)
									 {
										 erfolg = true;
									 }
								 }
							 }
							 else
							 {
								 data = &quot;leer&quot;;
								 array&lt;Byte&gt;^ msg = System::Text::Encoding::ASCII-&gt;GetBytes(data);
								 array&lt;Byte&gt;^ msgantw2 = nullptr;
								 stream-&gt;Write(msg, 0, msg-&gt;Length);
								 bool erfolg2 = false;
								 while (erfolg2 = false)
								 {
									 Int32 bytes = stream-&gt;Read(msgantw2, 0, msgantw2-&gt;Length);
									 String^ dataantw2 = System::Text::Encoding::ASCII-&gt;GetString(msgantw2, 0, bytes);
									 if (dataantw2 == &quot;Empfangen&quot;)
									 {
										 erfolg2 = true;
									 }
								 }
							 }
						 }
						 dssent = dssent + 1;
					 }
</code></pre>
<p>alle vorher gesetzten variablen die in dem Code-teil hier nicht deklariert sind, wurden im programm weiter oden deklariert und initialisiert.</p>
<p>hoffe ihr erkennt evtl den fehler...</p>
<p>mfg Poppkins</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1631118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631118</guid><dc:creator><![CDATA[Poppkins]]></dc:creator><pubDate>Tue, 16 Dec 2008 10:05:06 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 10:21:35 GMT]]></title><description><![CDATA[<p>Versuch mal</p>
<p>[cpp]</p>
<p>for (int a = 1; a <strong>&lt;=</strong> anzahlrows; a++)<br />
//setze die Schleife fort, solange a kleiner-gleich anzahlrows ist!</p>
<p>[/cpp]</p>
<p>Das gleiche gilt natürlich auch für die anderen for-Schleifen.</p>
<p>Außerdem fängt man bei solchen Geschichten üblicherweise bei Null an zu zählen.</p>
<p>EDIT: Hmm, die cpp-Tags wollen heute irgendwie nicht... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>EDIT: Ach ja, was du machst, nennt sich C++/CLI, dafür gibt's ein eigenes Board hier. Die nächste Frage also besser da stellen. <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/1631128</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631128</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Tue, 16 Dec 2008 10:21:35 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 10:26:59 GMT]]></title><description><![CDATA[<p>ok, danke, ich denk nächstes mal dran. habs mal geändert, neues problem:</p>
<pre><code>System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei ServerDB.Form1.timer1_Tick(Object sender, EventArgs e) in (Pfad)form1.h:Zeile 336.
</code></pre>
<p>betreffende Zeile:</p>
<pre><code>Int32 bytes = stream-&gt;Read(msgantw, 0, msgantw-&gt;Length);
</code></pre>
<p>und ich hab diesen fehler zigmal gehabt und kp wie ich ihn gelöst hab <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1631133</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631133</guid><dc:creator><![CDATA[Poppkins]]></dc:creator><pubDate>Tue, 16 Dec 2008 10:26:59 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 10:33:41 GMT]]></title><description><![CDATA[<p>Hört sich an, als wäre eines deiner Objekte (stream, msgantw?) gar nicht instanziiert worden. Ist aus deinem Code nicht ersichtlich. Und ich bin eben kein C++/CLI-Experte. Falls hier nix weiter kommt, stell diese neue Frage besser im passenden Forum:</p>
<p><a href="http://c-plusplus.net/forum/viewforum-var-f-is-58.html" rel="nofollow">http://c-plusplus.net/forum/viewforum-var-f-is-58.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1631141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631141</guid><dc:creator><![CDATA[_matze]]></dc:creator><pubDate>Tue, 16 Dec 2008 10:33:41 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 10:35:49 GMT]]></title><description><![CDATA[<p>mach ich, t-dem danke für die schnelle antwort <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/1631145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631145</guid><dc:creator><![CDATA[Poppkins]]></dc:creator><pubDate>Tue, 16 Dec 2008 10:35:49 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit For-Schleife on Tue, 16 Dec 2008 19:28:12 GMT]]></title><description><![CDATA[<p>Poppkins schrieb:</p>
<blockquote>
<p>t-dem</p>
</blockquote>
<p>Lustig, auf was für Abkürzungen die Leute alles kommen... <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1631464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1631464</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 16 Dec 2008 19:28:12 GMT</pubDate></item></channel></rss>