Solved

Reading and writing integers to file in big-endian order

Posted on 2004-10-05
3
408 Views
Last Modified: 2008-02-01
Hello,

I need to read and write integers (4 byte) from/to a file in big-endian order.  What is the best way to change the byte order of an integer in VB.NET?  I am writing a file with unicode strings and that part was easy using the Encoding object with a BinaryReader and BinaryWriter but the integer values are more difficult.

Thanks in advance,
Rob
0
Comment
Question by:rkellow
3 Comments
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12232643
big-endian?, the smallest first and the biggest last?
0
 

Author Comment

by:rkellow
ID: 12232822
The high-order byte first down to the low-order (big-endian).  This is the opposite of how Windows (Intel platforms) store values (little-endian).
0
 
LVL 8

Accepted Solution

by:
gregasm earned 500 total points
ID: 12233006
Use the BitConverter class.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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