Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading and writing integers to file in big-endian order

Posted on 2004-10-05
3
Medium Priority
?
418 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
[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
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 1500 total points
ID: 12233006
Use the BitConverter class.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

597 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