473,786 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help for Godsake Help me!! How can we do Parsing of Hexdecimel in C# reading string

1 New Member
How can we do Parsing of Hexdecimel in C# reading string from stream file for eg..

i have a file like..........

0f 2f 12 2d 3a.......in hexa decimal save in a file.txt and i m reading it from the file.......

now i have to convert this in decimal and save in an array.of integers....... i thought it can be achieved through parsing ..means 0f could be stored in array converted in decimal...but remmber i m reading from a file///////////////i work 4 hours on it but could not do anything....any one plz help....plz help........... ....
Nov 5 '06 #1
1 1647
anahcra
3 New Member
FileStream fs = File.OpenRead( FilePath );
StreamReader sr = new StreamReader( fs );
string sLine = sr.ReadLine();
while ( sLine != null )
{
string[] sArr = sLine.Split( ' ' );
int[] intArr = new int[ sArr.Length ];
int i = 0;
foreach ( string s in sArr )
{
byte x = Convert.ToByte( s, 16 );
intArr.SetValue ( x, i );
i++;
}
foreach( int a in intArr )
MessageBox.Show ( a.ToString() );
sLine = sr.ReadLine();
}
Nov 6 '06 #2

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

Similar topics

0
1413
by: bj0011 | last post by:
I am trying to parse an XML file obtained from a public WebService (see below). This file does not seem to be loading into a .NET XmlDocument right (I think it is because of all of the <Item Name="" Type=""></Item> elements). I need to get out the data for the <Id/>, Name="Authors", Name="Title", and Name="PubDate" elements. Anyone have an idea how to do this (I have tried to get them out short of dumping the doc out to a string and parsing it...
6
3440
by: dough | last post by:
Heres a snippet of my code. I am trying to dynamically allocate memory for reading in strings from a file. FILE *f; /* file to read */ char *s; /* string being read */ f = "somefile.txt"; s = malloc(sizeof(char*)); /* allocates mem of string */ while( fscanf(f, "%s", s) != EOF ) { /* read from FILE */
1
2295
by: vighnesh | last post by:
Hi All I am dealing a project in ASP.NET in which I have to establish a connection to SQL Server 2000 database,where the database was located on a remote system. For this I have used SQLConnection object and specified the connetion string.But when it comes to establish a connection its giving me the Error that I. Connection string : workstation id=localhost;packet size=4096;user
3
2477
by: agalkin | last post by:
Does anyone know any C/C++ source code for parsing CGI input string into name/value pairs? The only condition is not using any templates.
1
4486
by: [ Nicola ] | last post by:
Using imap i must zap through emails in my email address, then saving part of the message (the main body that is). Question is, how am i supposed to read only the message's content, ignoring all additional informations (charset and whatsoever? I'm currently reading the text like this: imap_body ($this->inbox, $i) Fact if, that this way i get all other information ex: ------------------------------- CONTENUTO DEL
4
2695
by: dom_perron | last post by:
Hi, I am developing ActiveX in MFC which has to display a bitmap from a string XML who contains binary data. I have parsing my XML string to get the binary data. Now, I want to create the bitmap object from the string but I dont know how. I use a CPictureHolder to display the image. Somebody would any have an idea? Thanks
4
3291
by: Academia | last post by:
My .chm file is an embedded resource so when I use it GetManifestResourceStream returns a Stream which I convert into a temp file. Then I try Help.ShowHelp(Me, tempFileFullPath, "Shortcuts.htm") which does not work.
3
3935
by: Daniel | last post by:
I have a list of strings, which I need to convert into tuples. If the string is not in python tuple format (i.e. "('one', 'two')", "("one", 'two')", etc.), then I can just make it a 1-tuple (i.e. return (string,) ). If it is in python tuple format, I need to parse it and return the appropriate tuple (it's ok to keep all tuple elements as strings). I think eval() will work for this, but I don't know what will be in the string, so I...
9
3138
by: victory2006 | last post by:
I need help converting a list into a string ex/ i want to compare this, "110"(string) to this (list) to see if they are identical. So, how would you do this? convert the string into a list? the list into a string? then compare the two? thanks in advance
0
9655
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.