471,344 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

hex ascii to short

I have an ascii file with hex values. I need to read the values and convert
the string to a short. Is there an easy way to do this?
Jul 21 '05 #1
2 2234
There is a KB article on how to do this (must be a common question).
http://support.microsoft.com/Default.aspx?kbid=835454

It should work the same with Int16.Parse() instead of Int32.Parse() if
you want shorts.
Joshua Flanagan
http://flimflan.com/blog

Bruce Wilhelm wrote:
I have an ascii file with hex values. I need to read the values and convert
the string to a short. Is there an easy way to do this?

Jul 21 '05 #2
If you are using VB, try something like this:
Dim s As String = "1C" ' a datum from your file goes here.
Dim i As Integer = CInt("&h" & s)
I believe a similar formulation will work in C#.
"Bruce Wilhelm" wrote:
I have an ascii file with hex values. I need to read the values and convert
the string to a short. Is there an easy way to do this?

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by - Steve - | last post: by
1 post views Thread by Mike Jeffers | last post: by
5 posts views Thread by sathyashrayan | last post: by
8 posts views Thread by Nik Martin | last post: by
61 posts views Thread by Christoph Zwerschke | last post: by
13 posts views Thread by greg | last post: by
14 posts views Thread by Luis P. Mendes | last post: by
10 posts views Thread by Wrecked | last post: by
reply views Thread by Ronak mishra | last post: by

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.