The UNIX and Linux Forums  


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
Negative Offset DNAx86 High Level Programming 1 05-09-2008 09:04 PM
Problem with sed and negative regexpr's ericbmn1 Shell Programming and Scripting 1 02-23-2008 06:03 AM
negative permissions sickoboy UNIX for Dummies Questions & Answers 4 10-12-2006 10:49 PM
RegExp negative match not working umen Shell Programming and Scripting 2 08-22-2006 05:57 PM
negative UID/GID?!! I can see 'em but what the hell do they mean?! hellz UNIX for Dummies Questions & Answers 2 09-07-2001 04:18 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-22-2008
Darklight Darklight is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 12
C++ how to isdigit() a negative number?

hi people,

I have a function which I am passing a stream which is basically postfix notation


Code:
    	if(isdigit(in.peek()))
		{
			in >> number;
			nums.push(number);
		}
		else if (strchr("+-*/", in.peek( )) != NULL)
		{
			in >> symbol;
			do_operation(symbol, nums, okay);
		}
    		else
		{	
			in.ignore();
		}

the stream I am passing would look like this:


Code:
2 -3 +

which is effectivley 2 + -3

the problem is that isdigit(in.peek()) is reading the '-' as a char and not part of the negative number..... what can I do?

Cheers in advance
 

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:50 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