473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

convert integer to hex, get the endianness right and pad the numbers out

I am trying to write to some memory and I am having some trouble because of the endianness of the memory and it being written in Hex. for the first three bytes, if I want to write to them I need to include the string "0000" "0100" "0200" in my command string. I'd just like to be able to have some code like

for dim counter as integer = 0 to 255

*** convert counter to hex *****

myfunction(hexstring)

next


any help would be great!
Sep 9 '13 #1
1 1162
solved my own problem:

Expand|Select|Wrap|Line Numbers
  1. Dim Num As Int16 = 1
  2.         Dim array As Byte() = BitConverter.GetBytes(Num)
  3.         Dim output As String = BitConverter.ToString(array, 0)
  4.         Dim outputarray() As String = Split(output, "-")
  5.         output = outputarray(0) & outputarray(1)
output then contains what I want!
Sep 10 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: gary | last post by:
I want to pick all intergers and decimal numbers out of a string. Would this be the most correct regular expression to use? "\d+\.?\d*"
0
by: Ste | last post by:
Hi, I have a dump with a table with this field: "hdstart" integer which contains integer like 1042758000 1028152800 etc etc How can I convert it to a SQL Server DateTime field? Thank in...
7
by: henrytcy | last post by:
Hi, How can I convert integer, for example 12113, to char array but without specify an array size in C programming? Thanks!
2
by: Tom | last post by:
I need to convert an integer to a GUID consisting only of capital letters and numbers. I also need to be able to convert it back again. I would prefer it was somewhat difficult to determine how...
2
karthickbabu
by: karthickbabu | last post by:
Hi In my application i want to convert integer to decimal. I get a input and using convert function to convert into decimal. But it shows as it self. My code like as below, Is any wrong in...
4
by: mthread | last post by:
Hi, I would like to know the method to convert integer to string. Thanx in advance.
4
by: cmdolcet69 | last post by:
I have the following created in vb 2003: Public Bitvalue as byte() Public Sub Upload () dim i as integer =0 for i = 0 to 4095 bitvalue=bitconverted.getbytes(i)
6
by: ngajay | last post by:
Please tell me... how to convert integer to hex in little endian format ? example : i'm input int = 9995 then the output in Array String is
2
by: pantherxin | last post by:
Writing program to calculate cir., area, etc. of circle. Radius is input as integer; how to convert integer to proceed with calculations?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.