The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check URL with ksh HexAnubis666 Shell Programming and Scripting 1 07-30-2008 05:29 AM
Calculation - Result not accurate if numbe too big epall UNIX for Dummies Questions & Answers 3 06-13-2006 10:11 AM
Script to check for a file, check for 2hrs. then quit mmarsh UNIX for Dummies Questions & Answers 2 09-16-2005 03:46 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-06-2008
amitpansuria amitpansuria is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 91
how to check whether given numbe ris hex or not

helo I have particular number

lets say 0x56

now thropugh c program how to check this number is hex or not

Regards,
Amit
  #2 (permalink)  
Old 10-06-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
All numbers are (normally) represented internally as binary objects. Do you mean you have a particular string that you want to parse? And you want to know if this string is hex? Or do you just want to parse any string -- decimal or hex -- into the proper internal representation?
  #3 (permalink)  
Old 10-06-2008
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Certain conventions are used when dealing with numbers in different bases. Hex digits are prefixed with 0x or 0X; octals have a leading zero; and decimals are written as is...
Code:
int dec, oct, hx;
oct = 056; /* octal 56 */ 
hx = 0x56; /* hex 56 */
dec = 56; /* decimal 56 */
Is that it or are you looking to parse a string of characters into hex / decimal digits? The requirements are not clear from your post.
  #4 (permalink)  
Old 10-06-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Or maybe you are simply looking for isxdigit()
  #5 (permalink)  
Old 10-07-2008
Saurabh78 Saurabh78 is offline
Registered User
  
 

Join Date: Jun 2004
Posts: 40
prefixed with 0x and every digit must be in between 0-9 and a-f.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0