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

String to long

Hi guys,


I have another problem with the RFID types.

I have a program that delivers me the RFID in a string

Expand|Select|Wrap|Line Numbers
  1. string RFID = 003000d4;
  2.  
But I have to get it in a long called RFIDlong, it tried several thing I found on the net.

Expand|Select|Wrap|Line Numbers
  1. RFIDlong = convert.toInt64(RFID);
  2. RFIDlong = long.parse(RFID);
And some other, but nothin has worked.


Can anyone help please?
May 12 '10 #1

✓ answered by Dheeraj Joshi

Did you tried

Expand|Select|Wrap|Line Numbers
  1. Convert.ToInt64(RFID,16);
  2.  
Regards
Dheeraj Joshi

4 2211
Dheeraj Joshi
1,123 Expert 1GB
Did you tried

Expand|Select|Wrap|Line Numbers
  1. Convert.ToInt64(RFID,16);
  2.  
Regards
Dheeraj Joshi
May 12 '10 #2
Yeah indeed, now it works.

Thanks man
May 12 '10 #3
Curtis Rutland
3,256 Expert 2GB
For the record, this also works:
Expand|Select|Wrap|Line Numbers
  1. string num = "003000d4";
  2. long l = long.Parse(num, System.Globalization.NumberStyles.HexNumber);
The issue seems to be the fact that the number is HEX. If it were not, then either of the things you tried first would work.
May 12 '10 #4
tlhintoq
3,525 Expert 2GB
I showed you how to properly format a hex number to become an int in the other thread you started on this problem. That is why we ask you to not start multiple threads on the same problem, because it divides efforts to help you. Look at the code in the first thread.
May 12 '10 #5

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

Similar topics

4
by: italia | last post by:
I changed the Fieldsize Property from text to Long Integer and Decimal Places = 6. I had decimals in the original field. But after the transfer, the digits after the decimals are gone. Now...
8
by: Jerry | last post by:
I have an off-the-shelf app that uses an Access database as its backend. One of the tables contains a field with an "OLE Object" datatype. I'm writing some reports against this database, and I...
0
by: Nick | last post by:
I am getting the following error when connecting to a access database via ODBC if the path contains a ascii character 127. Character 127 is a valid character for a path however access can not...
5
by: John Grandy | last post by:
Is there any way in C# to mimic the T-SQL EXEC() command (which runs a string as if it was in-line T-SQL code) ?
6
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards,...
33
by: Jordan Tiona | last post by:
How can I make one of these? I'm trying to get my program to store a string into a variable, but it only stores one line. -- "No eye has seen, no ear has heard, no mind can conceive what God...
4
by: shades234 | last post by:
what does the String(long, char*) funciton do? i can't seem to find an explination on the web. from the code i'm looking at, it appears to return a string of (value of long) of (value of char*)...
28
by: silvia.fama | last post by:
Hi! I'm using c language. I need to copy a long type value into a char string using a memcpy function: memcpy(string, (long *) value, len) this value will be then insert into a database. On...
1
by: Taka | last post by:
Hi there... The application im writing needs to calculate a persons age(as long) by entering the day, month and year into seperate textboxes. I want the application to calculate the age by using...
2
by: PengYu.UT | last post by:
Hi, In python, triple quote (""") can be used to quote a paragraph (multiple lines). I'm wondering if there is any equivalent in C++. For the following code, I could write the long string in a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.