<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Reading VARIANT from Stream - Delphi&#8217;s Way</title>
	<atom:link href="http://npavlov.kodar.net/blog/?feed=rss2&#038;p=12" rel="self" type="application/rss+xml" />
	<link>http://npavlov.kodar.net/blog/?p=12</link>
	<description>A blog about the rocky path of programming, and software engineering</description>
	<pubDate>Thu, 09 Sep 2010 04:59:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: KATHRYNBROOKS</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-14327</link>
		<dc:creator>KATHRYNBROOKS</dc:creator>
		<pubDate>Wed, 14 Jul 2010 10:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-14327</guid>
		<description>I propose not to wait until you get enough money to buy goods! You should just take the &lt;a href="http://bestfinance-blog.com/topics/credit-loans" rel="nofollow"&gt;credit loans&lt;/a&gt; or just collateral loan and feel fine</description>
		<content:encoded><![CDATA[<p>I propose not to wait until you get enough money to buy goods! You should just take the <a href="http://bestfinance-blog.com/topics/credit-loans" rel="nofollow" onclick="javascript:pageTracker._trackPageview ('/outbound/bestfinance-blog.com');">credit loans</a> or just collateral loan and feel fine</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-7408</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Thu, 12 Nov 2009 21:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-7408</guid>
		<description>Nik, I'm sorry, I think I've got some things wrong in my original question. However, I am using your code (this post and the other one) to transmit stream data via variants. Now I want to do the following: I have a TClientDataset that has been created and saved to a file (by another application). In my code, on the server side, I read this TClientDataset into a file stream. When trying to convert this file stream to a variant to send it to the Client, I get the mentioned EVariantTypeCastError.</description>
		<content:encoded><![CDATA[<p>Nik, I&#8217;m sorry, I think I&#8217;ve got some things wrong in my original question. However, I am using your code (this post and the other one) to transmit stream data via variants. Now I want to do the following: I have a TClientDataset that has been created and saved to a file (by another application). In my code, on the server side, I read this TClientDataset into a file stream. When trying to convert this file stream to a variant to send it to the Client, I get the mentioned EVariantTypeCastError.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-7233</link>
		<dc:creator>Nik</dc:creator>
		<pubDate>Mon, 02 Nov 2009 09:25:06 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-7233</guid>
		<description>Christian, I believe you misunderstood the purpose of the code.  The sample above deserializes a variant, serialized by the the appropriate code of another post (see the link in the first sentence).</description>
		<content:encoded><![CDATA[<p>Christian, I believe you misunderstood the purpose of the code.  The sample above deserializes a variant, serialized by the the appropriate code of another post (see the link in the first sentence).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-7075</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Mon, 26 Oct 2009 11:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-7075</guid>
		<description>Very nice code! Thanks for the great work.

However, when I try to deserialize a TFileStream, Delphi raises the exception EVariantTypeCastError: \'Could not convert variant of type (Empty) into type ($0996)\'. The file stream contains a TClientDataSet (that has been saved to a file).

How can I solve the problem?</description>
		<content:encoded><![CDATA[<p>Very nice code! Thanks for the great work.</p>
<p>However, when I try to deserialize a TFileStream, Delphi raises the exception EVariantTypeCastError: \&#8217;Could not convert variant of type (Empty) into type ($0996)\&#8217;. The file stream contains a TClientDataSet (that has been saved to a file).</p>
<p>How can I solve the problem?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-6279</link>
		<dc:creator>Nik</dc:creator>
		<pubDate>Wed, 27 May 2009 11:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-6279</guid>
		<description>Tim, I agree.  Thanks for pointing this out.

However, my goal was to show how to (de)serialize variants, and such details like position in the stream can be handled by developers themselves.  That's why I won't edit the code in the post.</description>
		<content:encoded><![CDATA[<p>Tim, I agree.  Thanks for pointing this out.</p>
<p>However, my goal was to show how to (de)serialize variants, and such details like position in the stream can be handled by developers themselves.  That&#8217;s why I won&#8217;t edit the code in the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Lichtenberg</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-6012</link>
		<dc:creator>Tim Lichtenberg</dc:creator>
		<pubDate>Tue, 24 Mar 2009 12:08:34 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-6012</guid>
		<description>the line 
Stream.Seek (0, soFromBeginning);  
is problematic. What if someone writes several variants into the same stream?
It should be up to the user to set the correct position in the stream.</description>
		<content:encoded><![CDATA[<p>the line<br />
Stream.Seek (0, soFromBeginning);<br />
is problematic. What if someone writes several variants into the same stream?<br />
It should be up to the user to set the correct position in the stream.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-234</link>
		<dc:creator>Nik</dc:creator>
		<pubDate>Mon, 27 Oct 2008 08:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-234</guid>
		<description>Hans, 

These two functions are mine as well, but I forgot to provide the code for them.  They don't do anything much special, I use them as kind of C macros.  

Here they are.

function IsSimpleType (VarType: word) : boolean;
begin
  Result := (VarType and varTypeMask) in
     [varByte, varSmallint, varInteger, varSingle, varDouble, varCurrency, varDate, varError, varBoolean];    
end;

function GetSimpleTypeSize (VarType: word): integer;
begin
  case VarType and varTypeMask of
    varSmallint: Result := SizeOf (Smallint);
    varInteger: Result := SizeOf (Integer);
    varSingle: Result := SizeOf (Single);
    varDouble: Result := SizeOf (Double);
    varCurrency: Result := SizeOf (Currency);
    varDate: Result := SizeOf (Double);
    varError: Result := SizeOf (Longint);
    varBoolean: Result := SizeOf (Boolean);
    varByte: Result := SizeOf (Byte);
  else
    Result := -1;
  end;
end;</description>
		<content:encoded><![CDATA[<p>Hans, </p>
<p>These two functions are mine as well, but I forgot to provide the code for them.  They don&#8217;t do anything much special, I use them as kind of C macros.  </p>
<p>Here they are.</p>
<p>function IsSimpleType (VarType: word) : boolean;<br />
begin<br />
  Result := (VarType and varTypeMask) in<br />
     [varByte, varSmallint, varInteger, varSingle, varDouble, varCurrency, varDate, varError, varBoolean];<br />
end;</p>
<p>function GetSimpleTypeSize (VarType: word): integer;<br />
begin<br />
  case VarType and varTypeMask of<br />
    varSmallint: Result := SizeOf (Smallint);<br />
    varInteger: Result := SizeOf (Integer);<br />
    varSingle: Result := SizeOf (Single);<br />
    varDouble: Result := SizeOf (Double);<br />
    varCurrency: Result := SizeOf (Currency);<br />
    varDate: Result := SizeOf (Double);<br />
    varError: Result := SizeOf (Longint);<br />
    varBoolean: Result := SizeOf (Boolean);<br />
    varByte: Result := SizeOf (Byte);<br />
  else<br />
    Result := -1;<br />
  end;<br />
end;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-233</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Sun, 26 Oct 2008 15:53:18 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-233</guid>
		<description>Thanx, for the sample, Nic. Which unit did you use for IsSimpleType() and GetSimpleTypeSize(0) ?</description>
		<content:encoded><![CDATA[<p>Thanx, for the sample, Nic. Which unit did you use for IsSimpleType() and GetSimpleTypeSize(0) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-146</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sun, 17 Aug 2008 04:05:50 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-146</guid>
		<description>Your blog is interesting! 
 
Keep up the good work!</description>
		<content:encoded><![CDATA[<p>Your blog is interesting! </p>
<p>Keep up the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Serialização de Variants : Malta on Delphi</title>
		<link>http://npavlov.kodar.net/blog/?p=12#comment-138</link>
		<dc:creator>Serialização de Variants : Malta on Delphi</dc:creator>
		<pubDate>Wed, 13 Aug 2008 01:18:29 +0000</pubDate>
		<guid isPermaLink="false">http://npavlov.kodar.net/blog/?p=12#comment-138</guid>
		<description>[...] tarde encontrei os posts de Nikolay Pavlov - nem acredito que encontrei um parente de Pavlov e ainda um que programa em Delphi! Nikolay estava [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] tarde encontrei os posts de Nikolay Pavlov - nem acredito que encontrei um parente de Pavlov e ainda um que programa em Delphi! Nikolay estava [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
