473,394 Members | 1,674 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,394 software developers and data experts.

Problem converting byte to hex number

1
Hi,

The below code doen't seem to work :-(( The hex number I am trying to fetch is incorrect. Please can any one throw somme light

Expand|Select|Wrap|Line Numbers
  1.  
  2. NetworkStream ns= new NetworkStream(soc);
  3. StringBuilder strBuff = new StringBuilder();
  4. Int64 ch;
  5. char rdCh;
  6.  
  7. do
  8. {
  9. ch = ns.ReadByte();                    
  10. rdCh = Convert.ToChar(ch);
  11. strBuff.Append(rdCh);
  12. } while (rdCh != '\n');
  13.  
  14. int size = Int32.Parse(strBuff.ToString(), System.Globalization.NumberStyles.HexNumber);
  15.  
  16.  
Feb 24 '07 #1
1 961
kenobewan
4,871 Expert 4TB
What is soc?
Feb 24 '07 #2

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

Similar topics

5
by: c duden | last post by:
I am attempting to encrypt some text and be able to decrypt it at a later time. I have two methods to do this: public static Byte EncryptText(string textToEncrypt, string encryptionHash) {...
3
by: Joshua Russell | last post by:
Hi, I've got a program (see source below) that makes a file and fills it with random binary values (from 0 to 255). The source below works, however the program creates files at a rate of about...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
8
by: moondaddy | last post by:
I need to convert a byte array to a string and pass it as a parameter in a URL and then convert it back to the original byte array. However, its getting scrambled in the conversion. In short,...
21
by: Mike | last post by:
I am having a problem getting AND to work. I have a MySQL database field defined as varbinary(8) with X00 in it. Then I have define statements with X01 in it. define('CERTACCESS_MEDALS', x01); ...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
3
by: news.microsoft.com | last post by:
Hello, I'm a VB.NET guy converting a C# app to VB.NET and ran into an issue. Steping through both the C# and VB.NET apps i get identical results but for one section. Notes: bit_buffer = 360...
23
by: Antony Clements | last post by:
i am using the following code private var1 as Long private var2 as Long private var3 as Long ReDim bytearray(0 To 3) ReDim bytearray2(0 To 3) For a = 0 To 3
0
by: grappeggia | last post by:
Hi everybody, I`m doing a project in which a microcontroller realises an A/D conversion of 8 channels and send then to the computer using the USB, over one serialport interface. On the PC, I`m...
2
by: shahiz | last post by:
basically im having null pointer exception //read an inputstream is = new DataInputStream(new FileInputStream("test.mpg")); loadBytes(is); //pass it as a datasource for the player public...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.