<?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[RS232]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin dabei, den Source-Code für die serielle Schnittstelle zu verstehen, was auch für einen Anfänger gar nicht leicht ist <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="🙂"
    /><br />
Kann mir bitte jemand kurz erklären, was genau in der Zeile 8 und 9 gemacht wird?</p>
<pre><code class="language-cpp">1  BOOL CSerial::Open (int nComPortNr, int nBaud, int nBits, int nParity, int nStopp)
2  {
3     if (INVALID_HANDLE_VALUE != hComm)   
4        	{
5          return (TRUE);
6	}
7
8     char szPort[16];
9
10    wsprintf (szPort, &quot;\\\\.\\COM%d&quot;, nComPortNr);
11
12    hComm = CreateFile( szPort,
13					    GENERIC_READ | GENERIC_WRITE,
14                        0,
15                        0,
16                        OPEN_EXISTING,
17                        FILE_ATTRIBUTE_NORMAL,
18                        NULL);

...
....
</code></pre>
<p>danke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154837/rs232</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Jul 2026 22:14:01 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154837.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 Jul 2006 10:33:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RS232 on Mon, 31 Jul 2006 10:33:51 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich bin dabei, den Source-Code für die serielle Schnittstelle zu verstehen, was auch für einen Anfänger gar nicht leicht ist <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="🙂"
    /><br />
Kann mir bitte jemand kurz erklären, was genau in der Zeile 8 und 9 gemacht wird?</p>
<pre><code class="language-cpp">1  BOOL CSerial::Open (int nComPortNr, int nBaud, int nBits, int nParity, int nStopp)
2  {
3     if (INVALID_HANDLE_VALUE != hComm)   
4        	{
5          return (TRUE);
6	}
7
8     char szPort[16];
9
10    wsprintf (szPort, &quot;\\\\.\\COM%d&quot;, nComPortNr);
11
12    hComm = CreateFile( szPort,
13					    GENERIC_READ | GENERIC_WRITE,
14                        0,
15                        0,
16                        OPEN_EXISTING,
17                        FILE_ATTRIBUTE_NORMAL,
18                        NULL);

...
....
</code></pre>
<p>danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1107626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1107626</guid><dc:creator><![CDATA[Maly]]></dc:creator><pubDate>Mon, 31 Jul 2006 10:33:51 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Mon, 31 Jul 2006 10:50:11 GMT]]></title><description><![CDATA[<p>Also in Zeile 8 wird ein char-Array mit 16 Plätzen deklariert.<br />
In Zeile 9 wird nix gemacht (ausser hier wurde mit hellgrauer Schrift auf gleichfarbigen Hintergrund geschrieben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1107636</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1107636</guid><dc:creator><![CDATA[Gill Bates]]></dc:creator><pubDate>Mon, 31 Jul 2006 10:50:11 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Mon, 31 Jul 2006 10:56:32 GMT]]></title><description><![CDATA[<p>ich habe mich verschrieben. ich meinte Zeile 10</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1107646</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1107646</guid><dc:creator><![CDATA[Maly]]></dc:creator><pubDate>Mon, 31 Jul 2006 10:56:32 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Mon, 31 Jul 2006 11:23:11 GMT]]></title><description><![CDATA[<p>ich wollte schreiben: ich habe mich vertippt ... gemeint ist Zeile 10</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1107671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1107671</guid><dc:creator><![CDATA[Maly]]></dc:creator><pubDate>Mon, 31 Jul 2006 11:23:11 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Mon, 31 Jul 2006 11:43:57 GMT]]></title><description><![CDATA[<blockquote>
<p>8 char szPort[16];<br />
9<br />
10 wsprintf (szPort, &quot;\\\.\\COM%d&quot;, nComPortNr);</p>
</blockquote>
<p>8: Es wird ein Array mit einer statischen größe geklariert</p>
<p>10: das array wird mit inhalt gefüllt - hier die adresse der seriellen schnittstelle</p>
<p>diese adresse wird dann nacher CreateFile(...) übergeben damit<br />
CreateFile(...) die Schnittstelle &quot;öffnen&quot; kann</p>
<p>das sind aber eig. normale standard-funktionen/operationen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1107694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1107694</guid><dc:creator><![CDATA[Babelduos Geist]]></dc:creator><pubDate>Mon, 31 Jul 2006 11:43:57 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 08:26:01 GMT]]></title><description><![CDATA[<p>was bedeutet eigentlich das 2. Argument in der wsprintf((szPort, <strong>&quot;\\\.\\COM%d&quot;</strong>, nComPortNr); ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108987</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108987</guid><dc:creator><![CDATA[Loku]]></dc:creator><pubDate>Wed, 02 Aug 2006 08:26:01 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 08:57:01 GMT]]></title><description><![CDATA[<p>Loku schrieb:</p>
<blockquote>
<p>was bedeutet eigentlich das 2. Argument in der wsprintf((szPort, <strong>&quot;\\\.\\COM%d&quot;</strong>, nComPortNr); ?</p>
</blockquote>
<p>das bedeutet soviel wie '\.\COMx'.<br />
das %d ist eine formatangabe für sprintf (dezimalzahl einsetzen).<br />
ein einzelnes \ muss in einem c-string als \\ geschrieben werden, weil \ eine soganannte escape-sequenz einleitet und \\ steht nunmal für \.<br />
ein '\.\COM1' sagt Createfile es soll im nt object directory \GLOBAL?? nach dem objekt COM1 suchen, was wiederum ein symbolischer link für '\Device\Serial0' ist und '\Device\Serial0' ist die schnittstelle des rs232 gerätetreibers zum ersten seriellen port...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1109010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1109010</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Wed, 02 Aug 2006 08:57:01 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 09:00:33 GMT]]></title><description><![CDATA[<p>Das ist einfach ein String... und wird zur Formatierung mit dem 3. Parameter verwendet...<br />
Die vielen Backslashes werden wegen den C/C++ String-Literals benötigt und damit man auch COM-Ports &gt; 9 öffnen kann... (siehe<br />
<a href="http://support.microsoft.com/kb/115831/en-us" rel="nofollow">http://support.microsoft.com/kb/115831/en-us</a><br />
)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1109013</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1109013</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Wed, 02 Aug 2006 09:00:33 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 09:23:30 GMT]]></title><description><![CDATA[<p>Danke euch beiden für die Antworten.<br />
Wie gebe ich dann das ein, wenn ich jetzt nur COM-Ports &lt;= 9 öffnen möchte ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1109027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1109027</guid><dc:creator><![CDATA[Loku]]></dc:creator><pubDate>Wed, 02 Aug 2006 09:23:30 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 09:26:44 GMT]]></title><description><![CDATA[<p>Loku schrieb:</p>
<blockquote>
<p>Wie gebe ich dann das ein, wenn ich jetzt nur COM-Ports &lt;= 9 öffnen möchte ?</p>
</blockquote>
<p>guck mal den link, den jochen gepostet hat...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1109028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1109028</guid><dc:creator><![CDATA[net 0]]></dc:creator><pubDate>Wed, 02 Aug 2006 09:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to RS232 on Wed, 02 Aug 2006 11:51:58 GMT]]></title><description><![CDATA[<p>ups, ich habe den Link übersehen.</p>
<p>Der Kompiler spuckt immer einen Fehler bei der Zeile mit AfxMessage() aus.</p>
<pre><code class="language-cpp">.....................
	if (m_hComm == INVALID_HANDLE_VALUE) 
            {
		AfxMessageBox(&quot;Error opening serial port&quot;);
		return (FALSE);
            }
....................
</code></pre>
<p>Fehler: &quot;AfxMessageBox&quot;: Durch keine der 2 Überladungen konnten alle Argumenttypen konvertiert werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1109142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1109142</guid><dc:creator><![CDATA[Loku]]></dc:creator><pubDate>Wed, 02 Aug 2006 11:51:58 GMT</pubDate></item></channel></rss>