?
Solved

Convert vb.net binary write code to asp

Posted on 2006-11-10
4
Medium Priority
?
1,192 Views
Last Modified: 2008-02-01
How would I covert the following vb.net code to asp code in order to create a binary file.              

Dim fs2 As New FileStream("c:\test.etu", FileMode.Create, FileAccess.Write)
            Dim sw As New BinaryWriter(fs2, System.Text.Encoding.Default)
            sw.Seek(0, SeekOrigin.End)
            sw.Write(CShort(101))
            sw.Write(CByte(4))
            sw.Write(CChar("f"))
            sw.Write(CChar("g"))
            sw.Write(CChar("h"))
            sw.Write(CChar("i"))
            sw.Write(CShort(100))
            sw.Write(CByte(4))
            sw.Write(CChar("g"))
            sw.Write(CChar("h"))
            sw.Write(CChar("j"))
            sw.Write(CChar("k"))
            sw.Write(CByte(255))
            sw.Write(CByte(255))  
            sw.Close()
            fs2.Close()

I tried the following but it would only write the "4" as text.  Plus im not sure the syntaxt for CShort in asp.
<%
 'Create an instance of the FSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Create the object and the binary file to write to
Set objBinaryFile = objFSO.CreateTextFile(Server.MapPath("test.etu"))
'Write the information to the file
objBinaryFile.Write (cbyte("4"))
'Close the file
objBinaryFile.Close
'Clean up
Set objFSO = Nothing
%>

0
Comment
Question by:sreichardt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Accepted Solution

by:
WMIF earned 2000 total points
ID: 17918814
asp's filesystem object doesnt really do binary well.  read this article for options.

http://www.motobit.com/tips/detpg_read-write-binary-files/
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question