473,228 Members | 1,792 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,228 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 2292
There is a KB article on how to do this (must be a common question).

It should work the same with Int16.Parse() instead of Int32.Parse() if
you want shorts.
Joshua Flanagan

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Bix | last post by:
As this is my very first post, I'd like to give thanks to all who support this with their help. Hopefully, this question hasn't been answered (too many times) before... If anyone could explain...
by: - Steve - | last post by:
I've been given a school assignment and while everything else is easy there's one topic I'm completley lost on. I've been given an ASCII file that looks like this. During start-up, the program...
by: Mike Jeffers | last post by:
Hi everyone, I need to convert data from a structure into hexadecimal ascii format. The structure is like this: struct ROOM_DATA { short room_number; short floor_number; long total_area;
by: sathyashrayan | last post by:
Group, I have some doubts in the following program. ------------------program--------------------- /* ** Make an ascii binary string into an integer. */ #include <string.h> unsigned int...
by: Nik Martin | last post by:
If I receive a message from the .net sockets class, it's a byte array. The original message is an ASCII string,like "70,70,70,70,70,0,0,0,0". The commas here represent individual bytes. The 70's...
by: Christoph Zwerschke | last post by:
On the page http://wiki.python.org/moin/Python3%2e0Suggestions I noticed an interesting suggestion: "These operators ≤ ≥ ≠ should be added to the language having the following meaning: ...
by: Paul Aspinall | last post by:
Hi I want to send an ASCII character string / stream to an IP address. I basically have 6 barcode printers, and a web interface. Depending on what is entered on the web page, will determine...
by: greg | last post by:
Hello, I'm searching to know if a local file is ascii or binary. I couldn't find it in the manual, is there a way to know that ? thanks, -- greg
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I'm developing a django based intranet web server that has a search page. Data contained in the database is mixed. Some of the words are...
by: Wrecked | last post by:
Could someone suggest a method to convert a Binary data to an ASCII data, with very less or no increase in the memory . The problem basically is there is an excrypted message which needs to be...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.