Click here to Skip to main content
11,476,994 members (74,284 online)

glennPattonBackInThePUB asked:

Open original thread
Hi All...(Particularly Original Griff!)
I have been battling a piece of hardware for some time, all I have left is to write out a value, I have manage to read from the <<Expletive Deleted>> smart card and write out to it. I have just seen the first bug If I write out a value of 255 or FF the system works. I now appear to be writing the number correctly however reading it back is the issue if I send 273 which is 111 in hex because of the oddities of this piece of hardware it needs to see it as 11100000 I have padded the string and all is well (that was due to some help by Orig. Griff and several others over Friday and this morning thanks to all) the issue now is I need to trim the string as when 11C00000 is read in it is interprited as 297795584
Value_Int = int.Parse(txtValueCredit.Text,System.Globalization.NumberStyles.HexNumber);
via that how ever the routine works fine for numbers that are less 255 (or FF!) over 255 it doesn't I am pretty sure it is to with the fact I am reading in reverse so any value that climbs over 255 such as 273 (111^16)is being read as 1110 or 11 10 and my the conversion routine above sees it as 1110 and gives 4368 how ever messing around I have found if the last character is removed with a Substring it works this does start to bother me though as the idea of chopping off a the last charcter seems a bit of a sledgehammer situation would I be better using an if to check for a 0 if its a 0 substring it if not treat it as part of the string for conversion. does that sound do-able, ah well off to the rain now I have finished for the day!
Glenn
Tags: C#

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100