<?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[Frage zur Konvertierung von time_t zu DWORD]]></title><description><![CDATA[<p>Ich kann einen bestimmten warning nicht beheben.</p>
<p>Es handelt sich um folgende Code Zeile:</p>
<pre><code>log.Gold2	= pItem-&gt;GetVisKeepTime( nPosition ) - time_null();
</code></pre>
<p>warning C4244: '=': Konvertierung von 'time_t' in 'DWORD', möglicher Datenverlust</p>
<p>Ich hab schon versucht mit deinem static_cast es zu DWORD downzucasten, jedoch hat das auch nicht funktioniert, deswegen wäre es lieb wenn es mir einer erklären könnte.</p>
<p>Dazu hab ich noch 2 Konflikte zwischen signed und unsigned</p>
<p>Hier:</p>
<pre><code>if( pUser-&gt;GetGold() &lt;  (UINT)( ( nPostGold + nGold ) ) )
</code></pre>
<p>und hier:</p>
<pre><code>if( pEquip-&gt;GetProp()-&gt;dwItemLV &gt;= it-&gt;first )
</code></pre>
<p>Mit freundlichen Grüßen,</p>
<p>Steve</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/312597/frage-zur-konvertierung-von-time_t-zu-dword</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 12:50:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/312597.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Jan 2013 21:01:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Wed, 09 Jan 2013 16:36:40 GMT]]></title><description><![CDATA[<p>Ich kann einen bestimmten warning nicht beheben.</p>
<p>Es handelt sich um folgende Code Zeile:</p>
<pre><code>log.Gold2	= pItem-&gt;GetVisKeepTime( nPosition ) - time_null();
</code></pre>
<p>warning C4244: '=': Konvertierung von 'time_t' in 'DWORD', möglicher Datenverlust</p>
<p>Ich hab schon versucht mit deinem static_cast es zu DWORD downzucasten, jedoch hat das auch nicht funktioniert, deswegen wäre es lieb wenn es mir einer erklären könnte.</p>
<p>Dazu hab ich noch 2 Konflikte zwischen signed und unsigned</p>
<p>Hier:</p>
<pre><code>if( pUser-&gt;GetGold() &lt;  (UINT)( ( nPostGold + nGold ) ) )
</code></pre>
<p>und hier:</p>
<pre><code>if( pEquip-&gt;GetProp()-&gt;dwItemLV &gt;= it-&gt;first )
</code></pre>
<p>Mit freundlichen Grüßen,</p>
<p>Steve</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2287759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2287759</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Wed, 09 Jan 2013 16:36:40 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Tue, 08 Jan 2013 21:23:19 GMT]]></title><description><![CDATA[<p>Der Compiler hat eben einfach Recht. Das sind ja auch nur Warnungen. Da findet ein möglicher Datenverlust statt und wenn du signed und unsigned Typen vergleichst musst du dir bewusst sein, was da passieren kann. Wenn du einen guten Grund für all diese Operationen hast, dann ignorier die Warnungen.</p>
<p>Wofür du aber sicher keinen guten Grund hast, sind die ganzen Casts, noch dazu C-Style Casts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_down"
      title=":-1:"
      alt="👎"
    /> . Benutz in C++ unbedingt die C++-Casts, die sind<br />
1. Besser lesbar<br />
2. Es ist klar was du erreichen willst und es kann auch kein überraschender Nebeneffekt auftreten. Ein C-Style Cast ist ein static-, const- und reinterpret-Cast in einem. Bist du immer sicher, dass du weißt, was passiert<sup>*</sup>?<br />
Außerdem sind viele Casts häufig ein Zeichen von schlechtem Design, was wieder zurück zum ersten Absatz dieser Antwort führt: Sollen denn da wirklich Variablen unterschiedlicher Signedness verglichen werden? Dies deutet darauf hin, dass dort Äpfel mit Birnen verglichen werden, oder dass die Äpfel eigentlich von vornherein Birnen sein sollten. Ebenso bei dem Datenverlust, wobei man es dort noch eher rechtfertigen kann.</p>
<p><sup>*</sup>: Klar gibt es Regeln, aber erfahrungsgemäß sind diese nicht immer bekannt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2287765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2287765</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 08 Jan 2013 21:23:19 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Wed, 09 Jan 2013 08:12:13 GMT]]></title><description><![CDATA[<p>Ah ok, danke ich verstehe was du meinst, diese Operationen sind schon gerechtfertigt, jedoch sind die Warnungen erst aufgetaucht als ich den Quellcode von VS2003 auf VS2012 portiert habe.</p>
<p>Die restlichen Fehler und Warnungen konnte ich auch leicht beheben, nur die wollen nicht so ganz.</p>
<p>Die static_cast habe ich lieber genommen als es mit voller Gewalt zB. so zu machen mit (Datentyp).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2287835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2287835</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Wed, 09 Jan 2013 08:12:13 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Thu, 10 Jan 2013 19:53:31 GMT]]></title><description><![CDATA[<p>Push... Würde trotzdem noch gerne eine Lösung für das Problem finden.</p>
<p>Mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288496</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Thu, 10 Jan 2013 19:53:31 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Thu, 10 Jan 2013 20:15:59 GMT]]></title><description><![CDATA[<p>Wenn es wirklich nur darum geht dass die Warnungen weg gehen:</p>
<pre><code>#pragma warning(disable : 4244)
</code></pre>
<p>Die korrekten Datentypen benutzen wäre natürlich hübscher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288512</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288512</guid><dc:creator><![CDATA[nwp3]]></dc:creator><pubDate>Thu, 10 Jan 2013 20:15:59 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 08:10:09 GMT]]></title><description><![CDATA[<p>Das ist es ja, ich will die Warnungen nicht per pragma abschalten, ich will sie schon beheben, nur welche Datentyp wären dafür angebracht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288606</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288606</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Fri, 11 Jan 2013 08:10:09 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 08:16:26 GMT]]></title><description><![CDATA[<p>Allowed schrieb:</p>
<blockquote>
<p>Das ist es ja, ich will die Warnungen nicht per pragma abschalten, ich will sie schon beheben, nur welche Datentyp wären dafür angebracht.</p>
</blockquote>
<p>Na dann musste halt einen signed-Datentypen nehmen... int oder long int.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288609</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Fri, 11 Jan 2013 08:16:26 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 08:22:18 GMT]]></title><description><![CDATA[<p>Danke, das signed und unsigned Problem ist behoben, dann wäre nur noch das Problem mit der konvertierung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288610</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288610</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Fri, 11 Jan 2013 08:22:18 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 08:24:01 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Allowed schrieb:</p>
<blockquote>
<p>Das ist es ja, ich will die Warnungen nicht per pragma abschalten, ich will sie schon beheben, nur welche Datentyp wären dafür angebracht.</p>
</blockquote>
<p>Na dann musste halt einen signed-Datentypen nehmen... int oder long int.</p>
</blockquote>
<p>Bzw. mal ne ganz doofe Frage. Wenn du fragst, welchen Datentypen du nehmen sollst, bedeutet das ja, du kannst ihn einfach ändern. Wieso nimmst du dann nicht einfach time_t? Wieso überhaupt iwelche Konvertierungen? <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>
]]></description><link>https://www.c-plusplus.net/forum/post/2288611</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288611</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Fri, 11 Jan 2013 08:24:01 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 09:28:35 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Wenn du fragst, welchen Datentypen du nehmen sollst, bedeutet das ja, du kannst ihn einfach ändern.</p>
</blockquote>
<p>Noch viel wichtiger: Wenn einfach solche Änderungen von signed nach unsigned vorgenommen werden können, ohne mit der Wimper zu zucken, dann war mein vorheriger Einwurf genau richtig</p>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Außerdem sind viele Casts häufig ein Zeichen von schlechtem Design, [...]: Sollen denn da wirklich Variablen unterschiedlicher Signedness verglichen werden? Dies deutet darauf hin, dass dort Äpfel mit Birnen verglichen werden, oder dass die Äpfel eigentlich von vornherein Birnen sein sollten.</p>
</blockquote>
<p>und die Antwort des Threaderstellers etwas voreilig:</p>
<p>Allowed schrieb:</p>
<blockquote>
<p>Ah ok, danke ich verstehe was du meinst, diese Operationen sind schon gerechtfertigt,</p>
</blockquote>
<p>Die Diagnose steht also: Falsches Design, die Datentypen repräsentieren nicht die Art von Objekten die sie sollten. Daher Tipp für den Threadersteller: Nochmal darüber nachdenken, welche Größe was ist und welche Eigenschaften sie hat und welcher Datentyp daher angebracht wäre. Das ist eine viel bessere Lösungsmethode als den Compiler über Casts und pragmas ruhig zustellen. Wie schon in der ersten Antwort gesagt wurde, hat der Compiler schließlich Recht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288637</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 11 Jan 2013 09:28:35 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Fri, 11 Jan 2013 11:25:46 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>out schrieb:</p>
<blockquote>
<p>Allowed schrieb:</p>
<blockquote>
<p>Das ist es ja, ich will die Warnungen nicht per pragma abschalten, ich will sie schon beheben, nur welche Datentyp wären dafür angebracht.</p>
</blockquote>
<p>Na dann musste halt einen signed-Datentypen nehmen... int oder long int.</p>
</blockquote>
<p>Bzw. mal ne ganz doofe Frage. Wenn du fragst, welchen Datentypen du nehmen sollst, bedeutet das ja, du kannst ihn einfach ändern. Wieso nimmst du dann nicht einfach time_t? Wieso überhaupt iwelche Konvertierungen? <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>
</blockquote>
<p>Ich verstehe jetzt nicht ganz den Sinn deines Satzes.</p>
<p>Ja natürlich kann ich die Datentypen verändern.<br />
Ich hatte natürlich auch meine Gründe dafür, jedoch hat sich anscheinend einiges geändert von VS2003 auf 12.</p>
<p>nGold ist vom Datentyp int<br />
nPostGold DWORD<br />
Und GetGold wird von der Klasse CMover abgeleitet welche vom Datentyp int ist.<br />
GetVisKeepTime ist vom Datentyp auch time_t und wird von der Klasse CItemElem abgeleitet.<br />
nPosition hat den Datentyp int</p>
<p>Mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288673</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Fri, 11 Jan 2013 11:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Sat, 12 Jan 2013 11:22:50 GMT]]></title><description><![CDATA[<p>Push</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288906</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288906</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Sat, 12 Jan 2013 11:22:50 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Sat, 12 Jan 2013 11:29:58 GMT]]></title><description><![CDATA[<p>Allowed schrieb:</p>
<blockquote>
<p>Push</p>
</blockquote>
<p>Was willst du wissen? Entweder sind die Datentypen richtig gewählt, dann kannst du die Warnung ignorieren, oder eben nicht. Was von beidem der Fall ist, das können wir dir nicht sagen, das musst du selber wissen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288908</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 12 Jan 2013 11:29:58 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Sat, 12 Jan 2013 11:52:52 GMT]]></title><description><![CDATA[<p>in VC2003 oder VC2012 steht in time.h</p>
<pre><code>typedef __int64   time_t;
</code></pre>
<p>int hat aber nur 32 Bit, da hätte der VC2003 eigentlich auch schon schimpfen müssen. wenn man einer 32 Bit Variablen einen 64 Bit Wert zuweist, können signifikante Bits verloren gehen, und genau das versucht der Compiler dir irgendwie mitzuteilen</p>
<p>verwende statt int einfach</p>
<pre><code>typedef __int64 MyInt;
</code></pre>
<p>wenn das Programm auch unter Linux laufen soll, verwende</p>
<pre><code>__extension__ typedef long long MyInt;
</code></pre>
<p>wenn dein Compiler das Headerfile cstdint hat, verwende</p>
<pre><code>typedef std::int64_t MyInt;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2288914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288914</guid><dc:creator><![CDATA[dd++ 0]]></dc:creator><pubDate>Sat, 12 Jan 2013 11:52:52 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Sat, 12 Jan 2013 14:37:55 GMT]]></title><description><![CDATA[<p>Naja nicht ganz, bei mir ist es anders definiert.</p>
<p>#ifndef _TIME_T_DEFINED<br />
#ifdef _USE_32BIT_TIME_T<br />
typedef __time32_t time_t; /* time value <em>/<br />
#else<br />
typedef __time64_t time_t; /</em> time value */<br />
#endif</p>
<p>Aber, danke den Rest werde ich alleine hinbekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2288963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2288963</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Sat, 12 Jan 2013 14:37:55 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 10:40:16 GMT]]></title><description><![CDATA[<p>So ich hab die ganzen Datentypen angepasst, also für die Konvertierungen von time_t in DWORD hab ich für DWORD, DWORD64 genommen.</p>
<p>Nur das verursacht noch mehr Probleme wie ich es mir schon gedacht habe.</p>
<pre><code>IntelliSense: Kein &quot;&gt;&gt;&quot;-Operator stimmt mit diesen Operanden überein.
            Operandentypen sind: CAr &gt;&gt; DWORD64
</code></pre>
<p>Die komplette Funktion mit CAr als Parameter ist wie folgt.</p>
<pre><code>void CDPClient::OnSetSkillState( CAr &amp; ar )
{
	WORD wType, wID;
	DWORD64 dwLevel;
	DWORD	dwTime;
	OBJID	idTarget;
	ar &gt;&gt; idTarget &gt;&gt; wType &gt;&gt; wID;
#if __VER &gt;= 11 // __SYS_COLLECTING
	if( wType == BUFF_ITEM2 )
	{
		time_t t;
		ar &gt;&gt; t;
		dwLevel		= time_null() + t;
	}
	else
		ar &gt;&gt; dwLevel;
#else	// __SYS_COLLECTING
	ar &gt;&gt; dwLevel;
#endif	// __SYS_COLLECTING
	ar &gt;&gt; dwTime;

	CMover *pTarget = prj.GetMover( idTarget );
	if( IsValidObj( pTarget ) )
		pTarget-&gt;AddBuff( wType, wID, dwLevel, dwTime );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2289486</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289486</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Mon, 14 Jan 2013 10:40:16 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 11:09:10 GMT]]></title><description><![CDATA[<p>COffenbar Cist Cin Cder CAr-CKlasse Ckein CStream-CExtraktionsoperator Cfür C64-CInteger Cdefiniert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289494</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 14 Jan 2013 11:09:10 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 11:48:10 GMT]]></title><description><![CDATA[<p>Decimad schrieb:</p>
<blockquote>
<p>COffenbar Cist Cin Cder CAr-CKlasse Ckein CStream-CExtraktionsoperator Cfür C64-CInteger Cdefiniert.</p>
</blockquote>
<p>Ähm ja. Danke für die Antwort.</p>
<p>Hier ist noch die kompllete Ar Klasse</p>
<pre><code>class CAr
{
public:
	CAr(void *lpBuf = NULL, u_int nBufSize = 0);
	~CAr();

// Flag values
	enum	{ store = 0, load = 1 };
	enum	{ nGrowSize = 16384 };

	static CHeapMng*	m_pHeapMng;

// Attributes
	BOOL	IsLoading()	const;
	BOOL	IsStoring()	const;

// Operations
	void	Read( void* lpBuf, u_int nSize );
	void	Write( const void* lpBuf, u_int nSize );
	void	CheckBuf( u_int nSize );
	void	Reserve( u_int nSize );
	void	Flush( void );
	void	ReelIn( u_int uOffset );

	// reading and writing strings
	void WriteString(LPCTSTR lpsz);
	LPTSTR ReadString(LPTSTR lpsz );
	LPTSTR ReadString( LPTSTR lpsz, int nBufSize );

	LPBYTE	GetBuffer( int* pnBufSize );
	u_long	GetOffset( void );
/*
	void	Copy( CAr &amp; ar );
	CAr&amp; operator = ( CAr &amp; ar );
*/
	// insertion operations
	CAr&amp; operator&lt;&lt;(BYTE by);
	CAr&amp; operator&lt;&lt;(WORD w);
	CAr&amp; operator&lt;&lt;(LONG l);
	CAr&amp; operator&lt;&lt;(DWORD dw);
	CAr&amp; operator&lt;&lt;(float f);
	CAr&amp; operator&lt;&lt;(double d);

	CAr&amp; operator&lt;&lt;(int i);
	CAr&amp; operator&lt;&lt;(short w);
	CAr&amp; operator&lt;&lt;(char ch);
	CAr&amp; operator&lt;&lt;(unsigned u);

	// extraction operations
	CAr&amp; operator&gt;&gt;(BYTE&amp; by);
	CAr&amp; operator&gt;&gt;(WORD&amp; w);
	CAr&amp; operator&gt;&gt;(DWORD&amp; dw);
	CAr&amp; operator&gt;&gt;(LONG&amp; l);
	CAr&amp; operator&gt;&gt;(float&amp; f);
	CAr&amp; operator&gt;&gt;(double&amp; d);

	CAr&amp; operator&gt;&gt;(int&amp; i);
	CAr&amp; operator&gt;&gt;(short&amp; w);
	CAr&amp; operator&gt;&gt;(char&amp; ch);
	CAr&amp; operator&gt;&gt;(unsigned&amp; u);

#ifdef __CLIENT
#ifdef _DEBUG
static	DWORD	s_dwHdrPrev;
static	DWORD	s_dwHdrCur;
#endif	// _DEBUG
#endif	// __CLIENT

protected:
	BYTE	m_nMode;	// read or write
	u_int	m_nBufSize;
	LPBYTE	m_lpBufCur;
	LPBYTE	m_lpBufMax;
	LPBYTE	m_lpBufStart;
	BYTE	m_lpBuf[nGrowSize];
};
/*
inline void CAr::Copy( CAr &amp; ar )
	{	ASSERT( IsLoading() );	ASSERT( ar.IsStoring() );	ar.Write( (void*)m_lpBufStart, (u_int)( m_lpBufMax - m_lpBufStart ) );	}
inline CAr&amp; CAr::operator = ( CAr &amp; ar )
	{	ar.Copy( *this );	return *this;	}
*/
inline BOOL CAr::IsLoading() const
	{ return (m_nMode &amp; CAr::load) != 0; }
inline BOOL CAr::IsStoring() const
	{ return (m_nMode &amp; CAr::load) == 0; }

inline CAr&amp; CAr::operator&lt;&lt;(int i)
	{ return CAr::operator&lt;&lt;((LONG)i); }
inline CAr&amp; CAr::operator&lt;&lt;(unsigned u)
	{ return CAr::operator&lt;&lt;((LONG)u); }
inline CAr&amp; CAr::operator&lt;&lt;(short w)
	{ return CAr::operator&lt;&lt;((WORD)w); }
inline CAr&amp; CAr::operator&lt;&lt;(char ch)
	{ return CAr::operator&lt;&lt;((BYTE)ch); }
inline CAr&amp; CAr::operator&lt;&lt;(BYTE by)
	{ CheckBuf( sizeof(BYTE) );
		*(UNALIGNED BYTE*)m_lpBufCur = by; m_lpBufCur += sizeof(BYTE); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(WORD w)
	{ CheckBuf( sizeof( WORD ) );
		*(UNALIGNED WORD*)m_lpBufCur = w; m_lpBufCur += sizeof(WORD); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(LONG l)
	{ CheckBuf( sizeof(LONG) );
		*(UNALIGNED LONG*)m_lpBufCur = l; m_lpBufCur += sizeof(LONG); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(DWORD dw)
	{ CheckBuf( sizeof(DWORD) );
		*(UNALIGNED DWORD*)m_lpBufCur = dw; m_lpBufCur += sizeof(DWORD); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(float f)
	{ CheckBuf( sizeof(float) );
		*(UNALIGNED FLOAT*)m_lpBufCur = *(FLOAT*)&amp;f; m_lpBufCur += sizeof(float); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(double d)
	{ CheckBuf( sizeof(double) );
		*(UNALIGNED double*)m_lpBufCur = *(double*)&amp;d; m_lpBufCur += sizeof(double); return *this; }

inline CAr&amp; CAr::operator&gt;&gt;(int&amp; i)
	{ return CAr::operator&gt;&gt;((LONG&amp;)i); }
inline CAr&amp; CAr::operator&gt;&gt;(unsigned&amp; u)
	{ return CAr::operator&gt;&gt;((LONG&amp;)u); }
inline CAr&amp; CAr::operator&gt;&gt;(short&amp; w)
	{ return CAr::operator&gt;&gt;((WORD&amp;)w); }
inline CAr&amp; CAr::operator&gt;&gt;(char&amp; ch)
	{ return CAr::operator&gt;&gt;((BYTE&amp;)ch); }

#define	CAR_SAFE_READ( type, value )	\
	if( m_lpBufCur + sizeof(type) &lt;= m_lpBufMax )	\
		{	value	= *(UNALIGNED type*)m_lpBufCur;	m_lpBufCur += sizeof(type);	}	\
	else	\
		{	value	= (type)0;	m_lpBufCur	= m_lpBufMax;	}	\
	return *this

inline CAr&amp; CAr::operator&gt;&gt;(BYTE&amp; by)
	{	CAR_SAFE_READ( BYTE, by );	}
inline CAr&amp; CAr::operator&gt;&gt;(WORD&amp; w)
	{	CAR_SAFE_READ( WORD, w );	}
inline CAr&amp; CAr::operator&gt;&gt;(DWORD&amp; dw)
	{	CAR_SAFE_READ( DWORD, dw );	}
inline CAr&amp; CAr::operator&gt;&gt;(float&amp; f)
	{	CAR_SAFE_READ( float, f );	}
inline CAr&amp; CAr::operator&gt;&gt;(double&amp; d)
	{	CAR_SAFE_READ( double, d );	}
inline CAr&amp; CAr::operator&gt;&gt;(LONG&amp; l)
	{	CAR_SAFE_READ( LONG, l );	}

#include &lt;D3DX9Math.h&gt;

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, D3DXVECTOR3 v)
	{	ar.Write( &amp;v, sizeof(D3DXVECTOR3) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, D3DXVECTOR3&amp; v)
	{	ar.Read( &amp;v, sizeof(D3DXVECTOR3) );		return ar;	}

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, __int64 i)
	{	ar.Write( &amp;i, sizeof(__int64) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, __int64&amp; i)
	{	ar.Read( &amp;i, sizeof(__int64) );	return ar;	}

/*
inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, CRect rect)
	{	ar.Write( &amp;rect, sizeof(CRect) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, CRect &amp; rect)
	{	ar.Read( &amp;rect, sizeof(CRect) );	return ar;	}
*/

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, RECT rect)
	{	ar.Write( &amp;rect, sizeof(RECT) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, RECT &amp; rect)
	{	ar.Read( &amp;rect, sizeof(RECT) );	return ar;	}

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, PLAY_ACCOUNT pa)
	{	ar.Write( &amp;pa, sizeof(PLAY_ACCOUNT) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, PLAY_ACCOUNT&amp; pa)
	{	ar.Read( &amp;pa, sizeof(PLAY_ACCOUNT) );	return ar;	}

inline u_long CAr::GetOffset( void )
{
	ASSERT( IsStoring() );
	return( m_lpBufCur - m_lpBufStart );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2289495</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289495</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Mon, 14 Jan 2013 11:48:10 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 12:00:53 GMT]]></title><description><![CDATA[<p>da sind wohl Operatoren für &quot;__int64&quot; definiert, ein DWORD64 ist aber ein &quot;unsigned __int64&quot;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289509</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289509</guid><dc:creator><![CDATA[dd++ 0]]></dc:creator><pubDate>Mon, 14 Jan 2013 12:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 13:28:57 GMT]]></title><description><![CDATA[<p>dd++ schrieb:</p>
<blockquote>
<p>da sind wohl Operatoren für &quot;__int64&quot; definiert, ein DWORD64 ist aber ein &quot;unsigned __int64&quot;</p>
</blockquote>
<p>Hab jetzt DWORD64 noch extra in die Ar Klasse hinzugefügt. Funktioniert auch jetzt soweit nur jetzt kommt ein Problem was normalerweise leicht zu lösen ist, ich hab auch alle nötigen Dateien includiert (DPClient.cpp und .h) Jedoch scheint es nicht die Lösung zu sein.</p>
<pre><code>DPClient.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;&quot;public: class CAr &amp; __thiscall CAr::operator&gt;&gt;(unsigned __int64 &amp;)&quot; (??5CAr@@QAEAAV0@AA_K@Z)&quot; in Funktion &quot;&quot;private: void __thiscall CDPClient::OnSetSkillState(class CAr &amp;)&quot; (?OnSetSkillState@CDPClient@@AAEXAAVCAr@@@Z)&quot;.
</code></pre>
<p>Die ar.h sieht momentan so aus.</p>
<pre><code>#ifndef __AR_H__
#define __AR_H__

#pragma once

#include &quot;HeapMng.h&quot;

class CAr
{
public:
	CAr(void *lpBuf = NULL, u_int nBufSize = 0);
	~CAr();

// Flag values
	enum	{ store = 0, load = 1 };
	enum	{ nGrowSize = 16384 };

	static CHeapMng*	m_pHeapMng;

// Attributes
	BOOL	IsLoading()	const;
	BOOL	IsStoring()	const;

// Operations
	void	Read( void* lpBuf, u_int nSize );
	void	Write( const void* lpBuf, u_int nSize );
	void	CheckBuf( u_int nSize );
	void	Reserve( u_int nSize );
	void	Flush( void );
	void	ReelIn( u_int uOffset );

	// reading and writing strings
	void WriteString(LPCTSTR lpsz);
	LPTSTR ReadString(LPTSTR lpsz );
	LPTSTR ReadString( LPTSTR lpsz, int nBufSize );

	LPBYTE	GetBuffer( int* pnBufSize );
	u_long	GetOffset( void );
/*
	void	Copy( CAr &amp; ar );
	CAr&amp; operator = ( CAr &amp; ar );
*/
	// insertion operations
	CAr&amp; operator&lt;&lt;(BYTE by);
	CAr&amp; operator&lt;&lt;(WORD w);
	CAr&amp; operator&lt;&lt;(LONG l);
	CAr&amp; operator&lt;&lt;(DWORD dw);
	CAr&amp; operator&lt;&lt;(float f);
	CAr&amp; operator&lt;&lt;(double d);
	CAr&amp; operator&lt;&lt;(DWORD64 dw64);

	CAr&amp; operator&lt;&lt;(int i);
	CAr&amp; operator&lt;&lt;(short w);
	CAr&amp; operator&lt;&lt;(char ch);
	CAr&amp; operator&lt;&lt;(unsigned u);

	// extraction operations
	CAr&amp; operator&gt;&gt;(BYTE&amp; by);
	CAr&amp; operator&gt;&gt;(WORD&amp; w);
	CAr&amp; operator&gt;&gt;(DWORD&amp; dw);
	CAr&amp; operator&gt;&gt;(LONG&amp; l);
	CAr&amp; operator&gt;&gt;(float&amp; f);
	CAr&amp; operator&gt;&gt;(double&amp; d);

	CAr&amp; operator&gt;&gt;(int&amp; i);
	CAr&amp; operator&gt;&gt;(short&amp; w);
	CAr&amp; operator&gt;&gt;(char&amp; ch);
	CAr&amp; operator&gt;&gt;(unsigned&amp; u);
	CAr&amp; operator&gt;&gt;(DWORD64&amp; dw64);

#ifdef __CLIENT
#ifdef _DEBUG
static	DWORD	s_dwHdrPrev;
static	DWORD	s_dwHdrCur;
#endif	// _DEBUG
#endif	// __CLIENT

protected:
	BYTE	m_nMode;	// read or write
	u_int	m_nBufSize;
	LPBYTE	m_lpBufCur;
	LPBYTE	m_lpBufMax;
	LPBYTE	m_lpBufStart;
	BYTE	m_lpBuf[nGrowSize];
};
/*
inline void CAr::Copy( CAr &amp; ar )
	{	ASSERT( IsLoading() );	ASSERT( ar.IsStoring() );	ar.Write( (void*)m_lpBufStart, (u_int)( m_lpBufMax - m_lpBufStart ) );	}
inline CAr&amp; CAr::operator = ( CAr &amp; ar )
	{	ar.Copy( *this );	return *this;	}
*/
inline BOOL CAr::IsLoading() const
	{ return (m_nMode &amp; CAr::load) != 0; }
inline BOOL CAr::IsStoring() const
	{ return (m_nMode &amp; CAr::load) == 0; }

inline CAr&amp; CAr::operator&lt;&lt;(int i)
	{ return CAr::operator&lt;&lt;((LONG)i); }
inline CAr&amp; CAr::operator&lt;&lt;(unsigned u)
	{ return CAr::operator&lt;&lt;((LONG)u); }
inline CAr&amp; CAr::operator&lt;&lt;(short w)
	{ return CAr::operator&lt;&lt;((WORD)w); }
inline CAr&amp; CAr::operator&lt;&lt;(char ch)
	{ return CAr::operator&lt;&lt;((BYTE)ch); }
inline CAr&amp; CAr::operator&lt;&lt;(BYTE by)
	{ CheckBuf( sizeof(BYTE) );
		*(UNALIGNED BYTE*)m_lpBufCur = by; m_lpBufCur += sizeof(BYTE); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(WORD w)
	{ CheckBuf( sizeof( WORD ) );
		*(UNALIGNED WORD*)m_lpBufCur = w; m_lpBufCur += sizeof(WORD); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(LONG l)
	{ CheckBuf( sizeof(LONG) );
		*(UNALIGNED LONG*)m_lpBufCur = l; m_lpBufCur += sizeof(LONG); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(DWORD dw)
	{ CheckBuf( sizeof(DWORD) );
		*(UNALIGNED DWORD*)m_lpBufCur = dw; m_lpBufCur += sizeof(DWORD); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(float f)
	{ CheckBuf( sizeof(float) );
		*(UNALIGNED FLOAT*)m_lpBufCur = *(FLOAT*)&amp;f; m_lpBufCur += sizeof(float); return *this; }
inline CAr&amp; CAr::operator&lt;&lt;(double d)
	{ CheckBuf( sizeof(double) );
		*(UNALIGNED double*)m_lpBufCur = *(double*)&amp;d; m_lpBufCur += sizeof(double); return *this; }

inline CAr&amp; CAr::operator&gt;&gt;(int&amp; i)
	{ return CAr::operator&gt;&gt;((LONG&amp;)i); }
inline CAr&amp; CAr::operator&gt;&gt;(unsigned&amp; u)
	{ return CAr::operator&gt;&gt;((LONG&amp;)u); }
inline CAr&amp; CAr::operator&gt;&gt;(short&amp; w)
	{ return CAr::operator&gt;&gt;((WORD&amp;)w); }
inline CAr&amp; CAr::operator&gt;&gt;(char&amp; ch)
	{ return CAr::operator&gt;&gt;((BYTE&amp;)ch); }

#define	CAR_SAFE_READ( type, value )	\
	if( m_lpBufCur + sizeof(type) &lt;= m_lpBufMax )	\
		{	value	= *(UNALIGNED type*)m_lpBufCur;	m_lpBufCur += sizeof(type);	}	\
	else	\
		{	value	= (type)0;	m_lpBufCur	= m_lpBufMax;	}	\
	return *this

inline CAr&amp; CAr::operator&gt;&gt;(BYTE&amp; by)
	{	CAR_SAFE_READ( BYTE, by );	}
inline CAr&amp; CAr::operator&gt;&gt;(WORD&amp; w)
	{	CAR_SAFE_READ( WORD, w );	}
inline CAr&amp; CAr::operator&gt;&gt;(DWORD&amp; dw)
	{	CAR_SAFE_READ( DWORD, dw );	}
inline CAr&amp; CAr::operator&gt;&gt;(float&amp; f)
	{	CAR_SAFE_READ( float, f );	}
inline CAr&amp; CAr::operator&gt;&gt;(double&amp; d)
	{	CAR_SAFE_READ( double, d );	}
inline CAr&amp; CAr::operator&gt;&gt;(LONG&amp; l)
	{	CAR_SAFE_READ( LONG, l );	}

#include &lt;D3DX9Math.h&gt;

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, D3DXVECTOR3 v)
	{	ar.Write( &amp;v, sizeof(D3DXVECTOR3) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, D3DXVECTOR3&amp; v)
	{	ar.Read( &amp;v, sizeof(D3DXVECTOR3) );		return ar;	}

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, __int64 i)
	{	ar.Write( &amp;i, sizeof(__int64) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, __int64&amp; i)
	{	ar.Read( &amp;i, sizeof(__int64) );	return ar;	}

/*
inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, CRect rect)
	{	ar.Write( &amp;rect, sizeof(CRect) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, CRect &amp; rect)
	{	ar.Read( &amp;rect, sizeof(CRect) );	return ar;	}
*/

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, RECT rect)
	{	ar.Write( &amp;rect, sizeof(RECT) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, RECT &amp; rect)
	{	ar.Read( &amp;rect, sizeof(RECT) );	return ar;	}

inline CAr&amp; operator&lt;&lt;(CAr &amp; ar, PLAY_ACCOUNT pa)
	{	ar.Write( &amp;pa, sizeof(PLAY_ACCOUNT) );	return ar;	}

inline CAr&amp; operator&gt;&gt;(CAr &amp; ar, PLAY_ACCOUNT&amp; pa)
	{	ar.Read( &amp;pa, sizeof(PLAY_ACCOUNT) );	return ar;	}

inline u_long CAr::GetOffset( void )
{
	ASSERT( IsStoring() );
	return( m_lpBufCur - m_lpBufStart );
}

#endif //__AR_H__
</code></pre>
<p>Und der Teil der DPClient.cpp</p>
<pre><code>void CDPClient::OnSetSkillState( CAr &amp; ar )
{
	//typedef DWORDLONG MyDword;
	WORD wType, wID;
	DWORD64 dw64Level;
	DWORD	dwTime;
	OBJID	idTarget;
	ar &gt;&gt; idTarget &gt;&gt; wType &gt;&gt; wID;
#if __VER &gt;= 11 // __SYS_COLLECTING
	if( wType == BUFF_ITEM2 )
	{
		time_t t;
		ar &gt;&gt; t;
		dw64Level		= time_null() + t;
	}
	else
		ar &gt;&gt; dw64Level;
#else	// __SYS_COLLECTING
	ar &gt;&gt; dw64Level;
#endif	// __SYS_COLLECTING
	ar &gt;&gt; dwTime;

	CMover *pTarget = prj.GetMover( idTarget );
	if( IsValidObj( pTarget ) )
		pTarget-&gt;AddBuff( wType, wID, dw64Level, dwTime );
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2289534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289534</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Mon, 14 Jan 2013 13:28:57 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 13:47:43 GMT]]></title><description><![CDATA[<p>nunja, wie der Compiler schon sagt, ist &quot;CAr&amp; operator&gt;&gt;(DWORD64&amp; dw64);&quot; zwar deklariert, aber nicht definiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289541</guid><dc:creator><![CDATA[dd++ 0]]></dc:creator><pubDate>Mon, 14 Jan 2013 13:47:43 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Mon, 14 Jan 2013 14:09:02 GMT]]></title><description><![CDATA[<p>dd++ schrieb:</p>
<blockquote>
<p>nunja, wie der Compiler schon sagt, ist &quot;CAr&amp; operator&gt;&gt;(DWORD64&amp; dw64);&quot; zwar deklariert, aber nicht definiert</p>
</blockquote>
<p>Ich hab nun die Definition noch hinzugefügt = same error.</p>
<p>typedef unsigned long long DWORD64;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289556</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Mon, 14 Jan 2013 14:09:02 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Tue, 15 Jan 2013 17:12:25 GMT]]></title><description><![CDATA[<p>Allowed schrieb:</p>
<blockquote>
<p>dd++ schrieb:</p>
<blockquote>
<p>nunja, wie der Compiler schon sagt, ist &quot;CAr&amp; operator&gt;&gt;(DWORD64&amp; dw64);&quot; zwar deklariert, aber nicht definiert</p>
</blockquote>
<p>Ich hab nun die Definition noch hinzugefügt = same error.</p>
<p>typedef unsigned long long DWORD64;</p>
</blockquote>
<p>Push</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289970</guid><dc:creator><![CDATA[Allowed]]></dc:creator><pubDate>Tue, 15 Jan 2013 17:12:25 GMT</pubDate></item><item><title><![CDATA[Reply to Frage zur Konvertierung von time_t zu DWORD on Tue, 15 Jan 2013 17:45:17 GMT]]></title><description><![CDATA[<p>Du pusht nun schon zum wiederholten Mal deine Fragen. Wenn deine Fragen nicht beantwortet werden, dann liegt das an den Fragen, nicht daran, dass dir keiner helfen möchte. Beziehungsweise ein bisschen möchte dir schon keiner helfen, denn deine Fragen sind nicht hilfreich <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>
<p><a href="http://www.c-plusplus.net/forum/200753" rel="nofollow">Du brauchst Hilfe?</a><br />
<a href="http://www.c-plusplus.net/forum/136013" rel="nofollow">Warum dir keiner helfen will</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2289982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2289982</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 15 Jan 2013 17:45:17 GMT</pubDate></item></channel></rss>