<?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[Struct aus einer Memberfunktion zurückgeben]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte ein Struct aus einer Memberfunktiuon am Stück zurückgeben. Wenn ich nachfolgenden Code benutze bekomme ich beim compilieren eine Fehlermeldung. Weis jemand woran das liegt ?</p>
<pre><code class="language-cpp">class CMathConv  
{
public:
	struct DataWord* Get16BitDec(int value);
	CMathConv();
	virtual ~CMathConv();

private:
 struct DataWord* m_ptr16BitValue;
};

DataWord* CMathConv::Get16BitDec(int value)
{	
	//struct DataWord result;

	m_ptr16BitValue-&gt;nByteH = 0;
	m_ptr16BitValue-&gt;nByteL = 0;

	// Wert kleiner wie 16 Bit
	if((value &lt;= 65535) &amp;&amp; (value &gt;= 0))
	{
		// Low-Byte verunden
		m_ptr16BitValue-&gt;nByteL = value &amp; 255;									// '0000 0000 1111 1111'

		// High-Byte verunden
		m_ptr16BitValue-&gt;nByteH = value &amp; 65280;						 // '1111 1111 0000 0000'
	}

	else
	{
		if(value &lt;= 65535)
			AfxMessageBox(&quot;Der übergebene Wert ist grösser wie 16 Bit&quot;, MB_ICONERROR);

		if(value &gt;= 0)
			AfxMessageBox(&quot;Der übergebene Wert ist negativ&quot;, MB_ICONERROR);
	}

	return *m_ptr16BitValue;      
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/59061/struct-aus-einer-memberfunktion-zurückgeben</link><generator>RSS for Node</generator><lastBuildDate>Tue, 02 Jun 2026 22:15:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/59061.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 18 Dec 2003 13:28:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Struct aus einer Memberfunktion zurückgeben on Thu, 18 Dec 2003 13:28:41 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte ein Struct aus einer Memberfunktiuon am Stück zurückgeben. Wenn ich nachfolgenden Code benutze bekomme ich beim compilieren eine Fehlermeldung. Weis jemand woran das liegt ?</p>
<pre><code class="language-cpp">class CMathConv  
{
public:
	struct DataWord* Get16BitDec(int value);
	CMathConv();
	virtual ~CMathConv();

private:
 struct DataWord* m_ptr16BitValue;
};

DataWord* CMathConv::Get16BitDec(int value)
{	
	//struct DataWord result;

	m_ptr16BitValue-&gt;nByteH = 0;
	m_ptr16BitValue-&gt;nByteL = 0;

	// Wert kleiner wie 16 Bit
	if((value &lt;= 65535) &amp;&amp; (value &gt;= 0))
	{
		// Low-Byte verunden
		m_ptr16BitValue-&gt;nByteL = value &amp; 255;									// '0000 0000 1111 1111'

		// High-Byte verunden
		m_ptr16BitValue-&gt;nByteH = value &amp; 65280;						 // '1111 1111 0000 0000'
	}

	else
	{
		if(value &lt;= 65535)
			AfxMessageBox(&quot;Der übergebene Wert ist grösser wie 16 Bit&quot;, MB_ICONERROR);

		if(value &gt;= 0)
			AfxMessageBox(&quot;Der übergebene Wert ist negativ&quot;, MB_ICONERROR);
	}

	return *m_ptr16BitValue;      
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/419063</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/419063</guid><dc:creator><![CDATA[DeGussu]]></dc:creator><pubDate>Thu, 18 Dec 2003 13:28:41 GMT</pubDate></item><item><title><![CDATA[Reply to Struct aus einer Memberfunktion zurückgeben on Thu, 18 Dec 2003 13:40:49 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>das Problem ist du musst einen Zeiger (laut Methodendefinition) zurückgeben und nicht den Wert an auf den gezeigt wird.</p>
<p>also...</p>
<p>return m_p.... und nicht return *m_p...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/419075</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/419075</guid><dc:creator><![CDATA[Elmar]]></dc:creator><pubDate>Thu, 18 Dec 2003 13:40:49 GMT</pubDate></item><item><title><![CDATA[Reply to Struct aus einer Memberfunktion zurückgeben on Thu, 18 Dec 2003 13:48:25 GMT]]></title><description><![CDATA[<p>Danke so funzt es :-))</p>
<p>und wie defieniere ich den Aufruf der Funktion ? Folgender Code funzt nicht.</p>
<pre><code class="language-cpp">...
struct DataWord* ptrValue;

CMathConv math;
ptrValue = math.Get16BitDec(800);        // geht nicht :-(((
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/419080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/419080</guid><dc:creator><![CDATA[DeGussu]]></dc:creator><pubDate>Thu, 18 Dec 2003 13:48:25 GMT</pubDate></item><item><title><![CDATA[Reply to Struct aus einer Memberfunktion zurückgeben on Thu, 18 Dec 2003 14:03:17 GMT]]></title><description><![CDATA[<p>Poste mal mehr von deinem Code, bitte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/419096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/419096</guid><dc:creator><![CDATA[Elmar]]></dc:creator><pubDate>Thu, 18 Dec 2003 14:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to Struct aus einer Memberfunktion zurückgeben on Thu, 18 Dec 2003 14:05:10 GMT]]></title><description><![CDATA[<p>Aloha,</p>
<p>wichtig wäre vor allen Dingen an welcher Stelle das Proggi wegknallt. Setze mal nen Haltepunkt und gehe Schritt für Schritt durch (auch durch die Funktion !!! ).</p>
<p>Grüße</p>
<p>BOA</p>
]]></description><link>https://www.c-plusplus.net/forum/post/419101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/419101</guid><dc:creator><![CDATA[BOA]]></dc:creator><pubDate>Thu, 18 Dec 2003 14:05:10 GMT</pubDate></item></channel></rss>