<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx</link><description>OK, back to scripting today. But before I get back to scripting issues, one brief correction. An attentive reader noted that "The Well-Tempered Clavier" was in fact designed to sound good on a "well tempered" instrument, not an "equally tempered" instrument.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410143</link><pubDate>Wed, 20 Apr 2005 20:43:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410143</guid><dc:creator>Alex Papadimoulis</dc:creator><description>Eric, I've had a lot of luck using the ADO Stream object.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410161</link><pubDate>Wed, 20 Apr 2005 21:51:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410161</guid><dc:creator>Curtis Hulett</dc:creator><description>I have used this in the past, but I don't know if it works in all locales. I have never had to deal with that. &lt;br&gt;&lt;br&gt;Function SaveBinaryData(FileName, ByteArray)&lt;br&gt;  Const adTypeBinary = 1&lt;br&gt;  Const adSaveCreateOverWrite = 2&lt;br&gt;  &lt;br&gt;  'Create Stream object&lt;br&gt;  Dim BinaryStream&lt;br&gt;  Set BinaryStream = CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;br&gt;  &lt;br&gt;  'Specify stream type - we want To save binary data.&lt;br&gt;  BinaryStream.Type = adTypeBinary&lt;br&gt;  &lt;br&gt;  'Open the stream And write binary data To the object&lt;br&gt;  BinaryStream.Open&lt;br&gt;  BinaryStream.Write ByteArray&lt;br&gt;  &lt;br&gt;  'Save binary data To disk&lt;br&gt;  BinaryStream.SaveToFile FileName, adSaveCreateOverWrite&lt;br&gt;End Function</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410186</link><pubDate>Wed, 20 Apr 2005 23:18:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410186</guid><dc:creator>Dave</dc:creator><description>Google says:&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://www.google.com/search?q=vbscript+binary+file"&gt;http://www.google.com/search?q=vbscript+binary+file&lt;/a&gt;&lt;br&gt;&lt;br&gt;And those paths generally lead to the Adodb.Stream solution.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410202</link><pubDate>Wed, 20 Apr 2005 23:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410202</guid><dc:creator>Eric Lippert</dc:creator><description>I've heard that, and I've also heard from people that it doesn't work well from script, so I don't know who to believe.  How do you create the binary array?  VBScript only supports creation of arrays of variants.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410258</link><pubDate>Thu, 21 Apr 2005 02:49:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410258</guid><dc:creator>hir</dc:creator><description>I found that text mode works OK like so.&lt;br&gt;Only for writing, though.&lt;br&gt;-----------------------------------------&lt;br&gt;&lt;br&gt;//JScript version&lt;br&gt;&lt;br&gt;var str = WScript.CreateObject(&amp;quot;ADODB.Stream&amp;quot;);&lt;br&gt;str.type = 2;	//adTypeText&lt;br&gt;str.charset = &amp;quot;iso-8859-1&amp;quot;;&lt;br&gt;str.open();&lt;br&gt;&lt;br&gt;for(var i = 0; i &amp;lt; 0x100; i++){&lt;br&gt;	str.writeText(String.fromCharCode(i));&lt;br&gt;}&lt;br&gt;str.saveToFile(&amp;quot;c:\\temp\\bin.bin&amp;quot;, 2);&lt;br&gt;str.close();&lt;br&gt;str = null;&lt;br&gt;&lt;br&gt;'VBScript version&lt;br&gt;&lt;br&gt;dim str&lt;br&gt;set str = WScript.CreateObject(&amp;quot;adodb.stream&amp;quot;)&lt;br&gt;str.type = 2&lt;br&gt;str.charset = &amp;quot;iso-8859-1&amp;quot;&lt;br&gt;str.open&lt;br&gt;&lt;br&gt;for i = 0 to &amp;amp;hff&lt;br&gt;	str.writeText(ChrW(i))	'uses ChrW&lt;br&gt;next&lt;br&gt;str.saveToFile &amp;quot;c:\temp\bin.bin&amp;quot;, 2&lt;br&gt;str.close&lt;br&gt;&lt;br&gt;-----------------------------------------&lt;br&gt;&lt;br&gt;There still is a problem when you try to read some of the byte values 0x80 - 0x9f: when you read them they turn into completely different values.  I guess this also relates to encoding.&lt;br&gt;&lt;br&gt;I heard you could acquire an array of bytes like this (haven't tried myself):&lt;br&gt;&lt;br&gt; Set DM = CreateObject(&amp;quot;Microsoft.XMLDOM&amp;quot;)&lt;br&gt; Set EL = DM.createElement(&amp;quot;tmp&amp;quot;)&lt;br&gt; EL.DataType = &amp;quot;bin.hex&amp;quot;&lt;br&gt; EL.Text = [some text in hex format]&lt;br&gt; bin = EL.NodeTypedValue</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410420</link><pubDate>Thu, 21 Apr 2005 16:34:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410420</guid><dc:creator>Mike Trinder</dc:creator><description>Further to this, is there a reason why Binary read/write was left out of the File System Object? I would have thought given the number of people that have asked you, that microsoft would have come up with something decent by now :)&lt;br&gt;&lt;br&gt;Surely it's just a simpler version of the FSO.OpenTextFile code?</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410432</link><pubDate>Thu, 21 Apr 2005 17:23:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410432</guid><dc:creator>Eric Lippert</dc:creator><description>We certainly considered it.  However, there are two main factors.  First, and most important, we decided that the Script Team wanted to be in the business of building the script engines themselves, not the objects that those engines would script.  We looked around the company and realized that other teams were working on object models for administration (WMI), email (CDONTS), database access (ADO), web servers (IIS), etc.  Our tiny team could never do as good a job as those fully staffed and dedicated teams, and to try would have taken away time from stuff that _wasn't_ a massive duplication of effort.  So we finished off the FSO and called it done.  (This also explains why we did not add any features to the WScript.Network object, etc, when we inherited the WSH codebase.)&lt;br&gt;&lt;br&gt;Second, adding binary file reading/writing is not as straightforward as you might think.  Exposing a straightforward array of bytes on disk is only the very first step.  To do it right and make it usable, we'd want to provide things like default serialization of all simple data types -- strings, ints, doubles, singles, currencies, etc.  But once you bite that off -- big endian or little endian?  Length prefixed?  How do you handle seeking?  What if the user is reading a file that has a DBCS string embedded in it and wants to translate it into a Unicode string?  &lt;br&gt;&lt;br&gt;You have to think about the real-world problems that people are going to have to solve with this tool, and there are a LOT of different scenarios for binary files.  We didn't want to bite that off.  It didn't seem like a very &amp;quot;scripty&amp;quot; scenario.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410645</link><pubDate>Fri, 22 Apr 2005 05:32:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410645</guid><dc:creator>Chris</dc:creator><description>You can use SoftArtisans' FileManager.  It's like FSO, but can handle binary files.&lt;br&gt;&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://fileup.softartisans.com/fileup-120.aspx"&gt;http://fileup.softartisans.com/fileup-120.aspx&lt;/a&gt;</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410681</link><pubDate>Fri, 22 Apr 2005 09:06:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410681</guid><dc:creator>Frederik Slijkerman</dc:creator><description>Even though writing binary files is not a 'scripty' scenario, it is something that people will want to do now and then. I don't see any reason why you couldn't have added simple binary read/write functions so you don't have to muck around with ADO stream objects or CreateTextFile.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#410745</link><pubDate>Fri, 22 Apr 2005 13:48:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:410745</guid><dc:creator>Marcus Tucker</dc:creator><description>I've been reading &amp;amp; writing binary data the &amp;quot;ADODB.Stream&amp;quot; object for years without any problems, but then again I haven't been using anything other than the UK codepage. But since it's got native binary handling, surely in this particular case binary is binary is binary?!</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#411565</link><pubDate>Mon, 25 Apr 2005 03:40:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:411565</guid><dc:creator>ptorr</dc:creator><description>ADODB.Recordset is quite popular in... certain communities. Unfortunately it requries that you have created an ADODB.Stream object, and I don't know how you go about populating that with arbitrary content.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#412227</link><pubDate>Tue, 26 Apr 2005 20:44:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:412227</guid><dc:creator>zwetan</dc:creator><description>JSDB based on spidermonkey&lt;br&gt;can read/write binary files&lt;br&gt;&lt;br&gt;see www.jsdb.org&lt;br&gt;&lt;br&gt;and much more than that: database connection, socket server, E4X etc..&lt;br&gt;&lt;br&gt;when I feel WSH is limited by something I automatically move to JSDB, both running ECMAScript code, portability made easy :).</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#416742</link><pubDate>Thu, 12 May 2005 07:21:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:416742</guid><dc:creator>Randall K.</dc:creator><description>I use Perl right now to read files and don't have any problems at all with binary. It doesn't require any special methods or variable types or even library includes. It's native to the language itself. It's unfortunate that the creators of Perl (an ancient scripting language by all comparisons), has always allowed working with binary files even across different platforms, but yet VBScript and JScript script developers are just left without access to any such basic routines as working with binary file data, even through the use of ActiveX controls (because there apparently aren't any).&lt;br&gt;&lt;br&gt;Keep in mind that ADODB.Stream is not a solution because it's disabled on most Windows machines now due to the security vulnerabilities it's imposed with Internet Explorer. You know, it's always nice when a workaround is suggest, then it's not even really available which I guess defeats the purpose.&lt;br&gt;&lt;br&gt;--Randall</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#524722</link><pubDate>Sat, 04 Feb 2006 11:44:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:524722</guid><dc:creator>berniem</dc:creator><description>&amp;quot;However, there are two main factors. First, and most important, we decided that the Script Team wanted to be in the business of building the script engines themselves, not the objects that those engines would script.&amp;quot;&lt;br/&gt;&lt;br/&gt;Ok, that's reasonable.  Add a few functions to the FSO to support binary byte reads and writes and y'all are done.  Simple, eh?  :-)&lt;br/&gt;&lt;br/&gt;&amp;quot;Second, adding binary file reading/writing is not as straightforward as you might think. Exposing a straightforward array of bytes on disk is only the very first step. To do it right and make it usable,... &amp;quot;&lt;br/&gt;&lt;br/&gt;Well, that's ONE approach.  Another, quite simple approach, is to NOT be the end-all and just support reading and writing a series of bytes.  If someone needs to make it more &amp;quot;usable&amp;quot;, they can do it themselves - that's the cost of dealing with BLOB data.  And that's exactly why y'all won't know whether it's big-endian, Unicode, or dollars.  Just let me get at the bytes and I'll do whatever is necessay to interpret/manipulate the data.  :-)&lt;br/&gt;&lt;br/&gt;As it is now, I seem to be left with a choice of:  a) moving to another language, or b) limiting functionality.  Neither is a good solution.&lt;br/&gt;&lt;br/&gt;Thanks.</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#544104</link><pubDate>Mon, 06 Mar 2006 00:09:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:544104</guid><dc:creator>John</dc:creator><description>Why is this such a big deal MS?? &amp;nbsp; UN*X systems have been doing this from day 1 !! &amp;nbsp;I guess it all stems from MS (or CP/M) making the decision years ago that text files NEED CR/LF pairs to be called text files rather than the UN*X philisophy that files are a stream of bytes and it's up to the end-user (or script developer) to decide how to interpret the bytes (or words or quadword ...).&lt;br&gt;</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#558963</link><pubDate>Thu, 23 Mar 2006 18:06:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:558963</guid><dc:creator>Seb</dc:creator><description>How can vb create a byte array? as.&lt;br&gt;&lt;br&gt;bytes = ChrB(1) &amp;amp; ChrB(1)&lt;br&gt;&lt;br&gt;..is still a string.&lt;br&gt;</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#559117</link><pubDate>Thu, 23 Mar 2006 20:55:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:559117</guid><dc:creator>Eric Lippert</dc:creator><description>In Visual Basic you create a byte array by, well, creating a byte array.&lt;br&gt;&lt;br&gt;dim b() as Byte&lt;br&gt;&lt;br&gt;In VBScript there is no way to create a byte array. &amp;nbsp;VBScript only supports arrays of variants.&lt;br&gt;&lt;br&gt;In VBScript if you create a string that contains binary data, and then pass that to an ActiveX object which expects a byte array, the default implementation of IDispatch::Invoke provided by the operating system will turn the binary string into a byte array for you. &amp;nbsp;So maybe that sneaky trick will work for you. &amp;nbsp;But my advice would be that if you need to create a byte array, the best thing to do would be to use a language which has byte arrays -- VB, C#, C++, etc.&lt;br&gt;</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#560576</link><pubDate>Sat, 25 Mar 2006 05:59:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:560576</guid><dc:creator>Igor</dc:creator><description>Eric,&lt;br&gt;you mentioned that creating a string that contains binary data would satisfy a COM method that expects a byte array. That is exactly what I am seeking. Could you please give an example of code that would create such string from a conventional VBScript string, say, &amp;quot;Hello World&amp;quot;? I am not &amp;quot;native&amp;quot; to ASP/VB, so maybe it's common knowledge for those who are in that world; sorry about that.&lt;br&gt;Thanks!</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#562254</link><pubDate>Mon, 27 Mar 2006 22:30:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:562254</guid><dc:creator>Igor</dc:creator><description>I found out a way to create an array of bytes in VBScript using ADODB.Stream object mentioned above, which resolved the problem I had. Thanks!</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#662799</link><pubDate>Wed, 12 Jul 2006 02:11:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:662799</guid><dc:creator>ATLANTES</dc:creator><description>EricLippert said:&lt;br&gt;How do you create the binary array? &lt;br&gt;&lt;br&gt;One way is to create a Text ADODB.Stream and copy it into a Binary ADODB.Stream.&lt;br&gt;Consider the following snippet I recently wrote to update a database connection UDL file:&lt;br&gt;&lt;br&gt; &amp;nbsp; Option Explicit&lt;br&gt;&lt;br&gt; &amp;nbsp; Dim sServer, sDatabase, sUsername, sPassword&lt;br&gt; &amp;nbsp; sServer &amp;nbsp; = &amp;quot;servername&amp;quot;&lt;br&gt; &amp;nbsp; sDatabase = &amp;quot;database&amp;quot;&lt;br&gt; &amp;nbsp; sUsername = &amp;quot;username&amp;quot;&lt;br&gt; &amp;nbsp; sUsername = &amp;quot;password&amp;quot;&lt;br&gt;&lt;br&gt; &amp;nbsp; Dim UDL&lt;br&gt; &amp;nbsp; UDL = ReadBinaryFile(&amp;quot;Old.udl&amp;quot;)&lt;br&gt; &amp;nbsp; UDL = SetValue(UDL, &amp;quot;Data Source&amp;quot;, sServer)&lt;br&gt; &amp;nbsp; UDL = SetValue(UDL, &amp;quot;Initial Catalog&amp;quot;, sDatabase)&lt;br&gt; &amp;nbsp; UDL = SetValue(UDL, &amp;quot;User ID&amp;quot;, sUsername)&lt;br&gt; &amp;nbsp; UDL = SetValue(UDL, &amp;quot;Password&amp;quot;, sPassword)&lt;br&gt; &amp;nbsp; UDL = SaveBinaryData(&amp;quot;New.udl&amp;quot;, UDL)&lt;br&gt;&lt;br&gt; ' =================================================================&lt;br&gt; ' Function to read text from a binary (unicode) file&lt;br&gt; ' =================================================================&lt;br&gt;&lt;br&gt; &amp;nbsp; Function ReadBinaryFile(FileName)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Const adTypeBinary = 1&lt;br&gt;&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim BinaryStream&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set BinaryStream = CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Type = adTypeBinary&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Open&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.LoadFromFile FileName&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ReadBinaryFile = BinaryStream.Read&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Close&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set BinaryStream = Nothing&lt;br&gt; &amp;nbsp; End Function&lt;br&gt;&lt;br&gt; ' =================================================================&lt;br&gt; ' Function to write a modified string back to a unicode file&lt;br&gt; ' =================================================================&lt;br&gt;&lt;br&gt; &amp;nbsp; Function SaveBinaryData(FileName, Text)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Const adTypeBinary = 1&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Const adTypeText = 2&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Const adSaveCreateOverWrite = 2&lt;br&gt;&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim BinaryStream&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set BinaryStream = CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Type = adTypeBinary&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Open&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;With CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .Type = adTypeText&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .Open: .WriteText Text&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .Position = 2&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .CopyTo BinaryStream, Len(Text) * 2&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .Close&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;End With&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.SaveToFile FileName, adSaveCreateOverWrite&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;BinaryStream.Close&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Set BinaryStream = Nothing&lt;br&gt; &amp;nbsp; End Function&lt;br&gt;&lt;br&gt; ' =================================================================&lt;br&gt; ' Function replace semicolon delimited values in a unicode string&lt;br&gt; ' =================================================================&lt;br&gt;&lt;br&gt; &amp;nbsp; Function SetValue(Data, Key, Value)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim Text, Prefix, Suffix, i&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Len(Value) = 0 Then&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetValue = Data&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Drop leading character&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Text = Mid(Data, 2)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i = InStr(Text, Key)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Prefix = Left(Text, i + Len(Key))&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Suffix = Mid(Text, i + Len(Key))&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i = InStr(Suffix, &amp;quot;;&amp;quot;)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if i = 0 Then&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Suffix = &amp;quot;&amp;quot;&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Else &lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Suffix = Mid(Suffix, i)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; End If&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Restore leading character and concatinate new value&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SetValue = Left(Data, 1) + Prefix + Value + Suffix&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;br&gt; &amp;nbsp; End Function&lt;br&gt;</description></item><item><title>GadgetChecker: a proposal for updating gadgets automatically</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#1881457</link><pubDate>Wed, 14 Mar 2007 19:24:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1881457</guid><dc:creator>LA.NET [EN]</dc:creator><description>&lt;p&gt;I've been playing with SideBar gadgets for some time now. Besides some quirks (ok, they're really bugs&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#2260381</link><pubDate>Tue, 24 Apr 2007 16:31:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2260381</guid><dc:creator>Brahim Raddahi</dc:creator><description>&lt;p&gt;Here's how to make a byte array, I extracted this from the example given by Hir&lt;/p&gt;
&lt;p&gt;Function VariantArrayToByteArray(arr)&lt;/p&gt;
&lt;p&gt;	dim DM, EL, bin&lt;/p&gt;
&lt;p&gt;	Set DM = CreateObject(&amp;quot;Microsoft.XMLDOM&amp;quot;) &lt;/p&gt;
&lt;p&gt;	Set EL = DM.createElement(&amp;quot;tmp&amp;quot;) &lt;/p&gt;
&lt;p&gt;	EL.DataType = &amp;quot;bin.hex&amp;quot; &lt;/p&gt;
&lt;p&gt;	EL.Text = ArrayToHexString(arr)&lt;/p&gt;
&lt;p&gt;	bin = EL.NodeTypedValue&lt;/p&gt;
&lt;p&gt;	VariantArrayToByteArray = bin&lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#2260384</link><pubDate>Tue, 24 Apr 2007 16:33:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2260384</guid><dc:creator>Brahim Raddahi</dc:creator><description>&lt;p&gt;You will also need thi function:&lt;/p&gt;
&lt;p&gt;Function ArrayToHexString(arr) &lt;/p&gt;
&lt;p&gt; &amp;nbsp;Dim I, B&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Redim B(UBound(arr)) &lt;/p&gt;
&lt;p&gt; &amp;nbsp;For I= 0 to UBound(arr)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;B(I) = right(&amp;quot;0&amp;quot; &amp;amp; hex(arr(I)), 2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Next &lt;/p&gt;
&lt;p&gt; &amp;nbsp;ArrayToHexString = Join(B,&amp;quot;&amp;quot;) &lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#2689894</link><pubDate>Thu, 17 May 2007 10:09:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2689894</guid><dc:creator>P.G.</dc:creator><description>&lt;p&gt;I have ie6 on my machine. I tried using adodb.stream from vbs for manipulating&lt;/p&gt;
&lt;p&gt;binary files. I understand that adodb.stream is not getting recognized and &lt;/p&gt;
&lt;p&gt;I am unable to save or read binary files through this. any ideas??&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#2845576</link><pubDate>Thu, 24 May 2007 19:56:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2845576</guid><dc:creator>Blue Streak</dc:creator><description>&lt;p&gt;Try using an HTA or VBS file.&lt;/p&gt;
&lt;p&gt;IE6 block dynamic content (i.e. scripts) in HTM, HTML files&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#5473141</link><pubDate>Tue, 16 Oct 2007 20:09:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5473141</guid><dc:creator>Ben</dc:creator><description>&lt;p&gt;Surely it is better to call it MBCS-land... and anyway, aren't we all in an MBCS land these days? Everything except the most basic of basic text files (that do not include any currency symbols other than the dollar sign ;-))&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#7630896</link><pubDate>Tue, 12 Feb 2008 07:17:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7630896</guid><dc:creator>Ian Freeman</dc:creator><description>&lt;p&gt;I came across newObjects' AXPack1 when I found out that Windows CE doesn't have FSO. It seems to have great support for Binary files. It's free too.&lt;/p&gt;
&lt;p&gt;Check out this VBS sample:&lt;/p&gt;
&lt;p&gt;Dim fso, file, BD, BoM&lt;/p&gt;
&lt;p&gt;Set fso = CreateObject(&amp;quot;newObjects.utilctls.SFMain&amp;quot;)&lt;/p&gt;
&lt;p&gt;Set file = fso.OpenFile(filename)&lt;/p&gt;
&lt;p&gt;Set BD = CreateObject(&amp;quot;newObjects.utilctls.SFBinaryData&amp;quot;)&lt;/p&gt;
&lt;p&gt;BD.Value = file.ReadBin(2) &amp;nbsp; 'read first 2 bytes&lt;/p&gt;
&lt;p&gt;BoM = BD.Data(0,1) &amp;nbsp; 'convert first 2 bytes to byte array&lt;/p&gt;
&lt;p&gt;file.Close()&lt;/p&gt;
&lt;p&gt;bom now contains the byte order mark of filename in a VT_UI | VT_ARRAY byte array.&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#8434888</link><pubDate>Mon, 28 Apr 2008 12:02:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8434888</guid><dc:creator>William Shakespeare</dc:creator><description>&lt;p&gt;If ADODB.Stream is a solution.&lt;/p&gt;
&lt;p&gt;I dont know what is much ado aabout nothing means.&lt;/p&gt;
&lt;p&gt;/****************************************************************************/&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Option Explicit&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Dim sServer, sDatabase, sUsername, sPassword&lt;/p&gt;
&lt;p&gt; &amp;nbsp;sServer &amp;nbsp; = &amp;quot;servername&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;sDatabase = &amp;quot;database&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;sUsername = &amp;quot;username&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;sUsername = &amp;quot;password&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Dim UDL&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = ReadBinaryFile(&amp;quot;Old.udl&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = SetValue(UDL, &amp;quot;Data Source&amp;quot;, sServer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = SetValue(UDL, &amp;quot;Initial Catalog&amp;quot;, sDatabase)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = SetValue(UDL, &amp;quot;User ID&amp;quot;, sUsername)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = SetValue(UDL, &amp;quot;Password&amp;quot;, sPassword)&lt;/p&gt;
&lt;p&gt; &amp;nbsp;UDL = SaveBinaryData(&amp;quot;New.udl&amp;quot;, UDL)&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt;' Function to read text from a binary (unicode) file&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Function ReadBinaryFile(FileName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Const adTypeBinary = 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Dim BinaryStream&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Set BinaryStream = CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Type = adTypeBinary&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Open&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.LoadFromFile FileName&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; ReadBinaryFile = BinaryStream.Read&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Set BinaryStream = Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt;' Function to write a modified string back to a unicode file&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Function SaveBinaryData(FileName, Text)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Const adTypeBinary = 1&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Const adTypeText = 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Const adSaveCreateOverWrite = 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Dim BinaryStream&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Set BinaryStream = CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Type = adTypeBinary&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Open&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; With CreateObject(&amp;quot;ADODB.Stream&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Type = adTypeText&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Open: .WriteText Text&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Position = 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.CopyTo BinaryStream, Len(Text) * 2&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; End With&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.SaveToFile FileName, adSaveCreateOverWrite&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; BinaryStream.Close&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Set BinaryStream = Nothing&lt;/p&gt;
&lt;p&gt; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt;' Function replace semicolon delimited values in a unicode string&lt;/p&gt;
&lt;p&gt;' =================================================================&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Function SetValue(Data, Key, Value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Dim Text, Prefix, Suffix, i&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; If Len(Value) = 0 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SetValue = Data&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Drop leading character&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Text = Mid(Data, 2)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i = InStr(Text, Key)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Prefix = Left(Text, i + Len(Key))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Suffix = Mid(Text, i + Len(Key))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i = InStr(Suffix, &amp;quot;;&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if i = 0 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Suffix = &amp;quot;&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Suffix = Mid(Suffix, i)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'Restore leading character and concatinate new value&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SetValue = Left(Data, 1) + Prefix + Value + Suffix&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp;End Function&lt;/p&gt;
&lt;p&gt;July 11, 2006 7:11 PM &lt;/p&gt;
&lt;p&gt;/****************************************************************************/&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#8737498</link><pubDate>Wed, 16 Jul 2008 11:32:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8737498</guid><dc:creator>12demons</dc:creator><description>&lt;p&gt;hem. just test that FileSystemObject can be use to READ and WRITE binary file. only that you had to CHEAT a little. Instead of using ReadAll() just use recursice Read() to the file Size. a little snippet in JScript:&lt;/p&gt;
&lt;p&gt;-- Code Start --&lt;/p&gt;
&lt;p&gt;var objFileSystem = new ActiveXObject('Scripting.FileSystemObject');&lt;/p&gt;
&lt;p&gt;var objFileIO = objFileSystem.GetFile('pack.exe');&lt;/p&gt;
&lt;p&gt;var streamIO = objFileIO.OpenAsTextStream();&lt;/p&gt;
&lt;p&gt;var strTransform = new Array();&lt;/p&gt;
&lt;p&gt;for (i=0;i&amp;lt;objFileIO.Size;i++) {&lt;/p&gt;
&lt;p&gt;	var strContent = streamIO.Read(1);&lt;/p&gt;
&lt;p&gt;	strTransform[i] = strContent.charCodeAt(0);&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;streamIO.Close();&lt;/p&gt;
&lt;p&gt;objFileIO = objFileSystem.CreateTextFile('dumb.exe', true);&lt;/p&gt;
&lt;p&gt;for (i=0;i&amp;lt;strTransform.length;i++) { objFileIO.Write(strTransform[i]); }&lt;/p&gt;
&lt;p&gt;objFileIO.Close();&lt;/p&gt;
&lt;p&gt;-- Code End --&lt;/p&gt;
&lt;p&gt;Basicaly copy pack.exe into Array then write Array into dumb.exe&lt;/p&gt;
&lt;p&gt;Surprisingly both are identical and executable. Isn't strange?&lt;/p&gt;
&lt;p&gt;All i need now is smart way to play with the Array .... &lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#8737502</link><pubDate>Wed, 16 Jul 2008 11:35:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8737502</guid><dc:creator>12demons</dc:creator><description>&lt;p&gt;ups. Sorry ... a typo in the code. just replace:&lt;/p&gt;
&lt;p&gt;strTransform[i] = strContent.charCodeAt(0);&lt;/p&gt;
&lt;p&gt;into&lt;/p&gt;
&lt;p&gt;strTransform[i] = strContent;&lt;/p&gt;
&lt;p&gt;I use charCodeAt to play around with ASCII code .....&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#9602240</link><pubDate>Mon, 11 May 2009 13:17:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9602240</guid><dc:creator>Michele Fiorantino</dc:creator><description>&lt;p&gt;Scriptable Byte Array &amp;nbsp;&lt;/p&gt;
&lt;p&gt; Function CreateByteArray(nsize)&lt;/p&gt;
&lt;p&gt;Dim sBin&lt;/p&gt;
&lt;p&gt;Set sBin = CreateObject(&amp;quot;Adodb.Stream&amp;quot;)&lt;/p&gt;
&lt;p&gt;sBin.Open&lt;/p&gt;
&lt;p&gt;sBin.Type = 2 ' adTypeText = 2&lt;/p&gt;
&lt;p&gt;sBin.WriteText String(nsize, Chr(0))&lt;/p&gt;
&lt;p&gt;sBin.Position = 0&lt;/p&gt;
&lt;p&gt;sBin.Type = 1 ' adTypeBinary&lt;/p&gt;
&lt;p&gt;CreateByteArray = sBin.Read(nsize)&lt;/p&gt;
&lt;p&gt;sBin.Close &lt;/p&gt;
&lt;p&gt;End Function&lt;/p&gt;
</description></item><item><title>re: Binary Files and the File System Object Do Not Mix</title><link>http://blogs.msdn.com/ericlippert/archive/2005/04/20/binary-files-and-the-file-system-object-do-not-mix.aspx#9924803</link><pubDate>Wed, 18 Nov 2009 22:37:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9924803</guid><dc:creator>Kirby L. Wallace</dc:creator><description>&lt;p&gt;I use FSO and ADO.Streams for most of my binary file ops already. &amp;nbsp;But... &amp;nbsp;A comment here...&lt;/p&gt;
&lt;p&gt;The problem you seem to be describing here doesn't seem to have so much to do with the FileSystemObject, but rather with a quirky behaviour in the CHR() function. &amp;nbsp;The fso seems to happily, and binarily, write your binary file without hesitation. &amp;nbsp;It only broke down when you tried to make the CHR() function do something it isn't supposed to do. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Wouldn't an ADO stream have done the same thing with that same input?&lt;/p&gt;
</description></item></channel></rss>