<?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[Vergleich von TCHAR]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe folgende Funktion:</p>
<pre><code class="language-cpp">bool getUsbInterface( int VID, int PID, TCHAR* name, usbInterface* usb_interface )
{		
	for ( int i = 0; i &lt; numInterfaces; i++ )
	{
		if ( /*foundUsbInterfaces[i].vendorID  == VID &amp;&amp; 
			 foundUsbInterfaces[i].productID == PID &amp;&amp; */

			 _tcscmp( foundUsbInterfaces[i].name, name ) )
			 // Vergleich geht nicht (immer true)
		{

			usb_interface = &amp;foundUsbInterfaces[i];
			// Probleme mit Zeiger 
			return true;
		}
	}	
	return false;
}
</code></pre>
<p>aufgerufen wird sie so</p>
<pre><code class="language-cpp">#define NAME _T(&quot;HID-konformes Gerät&quot;)
...
usbInterface myInterface;
if ( usb.getUsbInterface( vid, pid, NAME, &amp;myInterface ) )
...
</code></pre>
<p>foundUsbInterfaces[i].name ist ein TCHAR mit der Länge 255 ...</p>
<p>warum gibt er mir beim vergleich mit _tcscmp immer true zurück auch wenn die zwei werte anders sind ? wenn im vc++ 2005 nen watch auf &quot;name&quot; mache, so steht da auch immer nur der erste buchstabe drinnen.</p>
<p>kann mir jemand helfen?</p>
<p>grüße Nils</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/162510/vergleich-von-tchar</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 09:20:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/162510.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Oct 2006 11:32:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 11:32:44 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich habe folgende Funktion:</p>
<pre><code class="language-cpp">bool getUsbInterface( int VID, int PID, TCHAR* name, usbInterface* usb_interface )
{		
	for ( int i = 0; i &lt; numInterfaces; i++ )
	{
		if ( /*foundUsbInterfaces[i].vendorID  == VID &amp;&amp; 
			 foundUsbInterfaces[i].productID == PID &amp;&amp; */

			 _tcscmp( foundUsbInterfaces[i].name, name ) )
			 // Vergleich geht nicht (immer true)
		{

			usb_interface = &amp;foundUsbInterfaces[i];
			// Probleme mit Zeiger 
			return true;
		}
	}	
	return false;
}
</code></pre>
<p>aufgerufen wird sie so</p>
<pre><code class="language-cpp">#define NAME _T(&quot;HID-konformes Gerät&quot;)
...
usbInterface myInterface;
if ( usb.getUsbInterface( vid, pid, NAME, &amp;myInterface ) )
...
</code></pre>
<p>foundUsbInterfaces[i].name ist ein TCHAR mit der Länge 255 ...</p>
<p>warum gibt er mir beim vergleich mit _tcscmp immer true zurück auch wenn die zwei werte anders sind ? wenn im vc++ 2005 nen watch auf &quot;name&quot; mache, so steht da auch immer nur der erste buchstabe drinnen.</p>
<p>kann mir jemand helfen?</p>
<p>grüße Nils</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157585</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Thu, 19 Oct 2006 11:32:44 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 11:37:48 GMT]]></title><description><![CDATA[<p>Weil du die Funktionsweise von _tscmp() nicht verstanden hast <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>
<p><a href="http://man.cx/strcmp()" rel="nofollow">man: strcmp()</a> gibt 0 (= FALSE) zurück, wenn die Strings identisch sind, und einen Wert !=0 (= TRUE), wenn sie verschieden sind (damit ist es auch möglich anzugeben, welcher String lexikografisch &quot;größer&quot; war).</p>
<p>(und _tscmp() ist die TCHAR-Version von strcmp())</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157589</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Oct 2006 11:37:48 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 11:41:40 GMT]]></title><description><![CDATA[<p>hehe das würds erklären, danke schön.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157591</guid><dc:creator><![CDATA[nils_langner]]></dc:creator><pubDate>Thu, 19 Oct 2006 11:41:40 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 11:48:35 GMT]]></title><description><![CDATA[<p>Noch ne Sache, wo ist mein Denkfehler bei der Rückgabe, des Interfaces? Ich hätte gerne im Hauptprogramm nach dem aufruf, von</p>
<pre><code class="language-cpp">usbInterface myInterface;
if ( usb.getUsbInterface( vid, pid, NAME, &amp;myInterface ) )
...
</code></pre>
<p>in myInterface die Sachen drin stehen, die hier</p>
<pre><code class="language-cpp">usb_interface = &amp;foundUsbInterfaces[i];
</code></pre>
<p>zugewiesen wurden. Sorry ich bin neu in c++ und mit den ganzen Zeigern hab ich noch ein wenig meine Probleme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157598</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Thu, 19 Oct 2006 11:48:35 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 12:19:58 GMT]]></title><description><![CDATA[<p>Mit der Anweisung biegst du nur den (lokalen) Zeiger um. Du solltest stattdessen den Wert hinter diesem Zeiger neu zuweisen:</p>
<pre><code class="language-cpp">*usb_interface = foundUsbInterfaces[i];
</code></pre>
<p>(btw, in C++ nimmt man üblicherweise Referenzen für Ausgabeparameter)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157618</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157618</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 19 Oct 2006 12:19:58 GMT</pubDate></item><item><title><![CDATA[Reply to Vergleich von TCHAR on Thu, 19 Oct 2006 12:42:22 GMT]]></title><description><![CDATA[<p>Wunderbar ... es klappt ... vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157634</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157634</guid><dc:creator><![CDATA[Nils_Langner]]></dc:creator><pubDate>Thu, 19 Oct 2006 12:42:22 GMT</pubDate></item></channel></rss>