469,616 Members | 1,627 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

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

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 1502
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

Post your reply

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

Similar topics

reply views Thread by bj0011 | last post: by
6 posts views Thread by dough | last post: by
3 posts views Thread by agalkin | last post: by
1 post views Thread by [ Nicola ] | last post: by
4 posts views Thread by dom_perron | last post: by
3 posts views Thread by Daniel | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.