LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2015, 06:04 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
Std::to_string returns negative number as pos


hi all
I'm using to string to return variables from a server. However if the number is negative it returns positive . Eg int I = -1 returns 4......... I know the technical reason for this, so I'm just looking for a work round is there a way to tell to-string to keep the correct sign.
Sorry typos using phone!
Thanks in advance 😀
 
Old 07-10-2015, 06:16 AM   #2
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Sorry All,
Of course after spending an hour trying to work this out, the posting here I work it out in seconds. I was copying the int over to another variable to produce the message and it was an unsigned...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have to write a function that returns the nth prime number in C. But getting error! pipideni Linux - Newbie 9 11-07-2014 07:58 AM
[SOLVED] Bash subtract negative number using bc porphyry5 Programming 10 05-17-2011 11:12 AM
[SOLVED] How to grep a negative number in a file nasridine Linux - Newbie 3 03-04-2010 08:28 PM
LXer: Volante POS Systems Announces Secure Linux POS Solution for ... LXer Syndicated Linux News 0 12-14-2006 08:54 PM
Trying to figure out the number of characters in a std::string, using length. RHLinuxGUY Programming 4 05-23-2006 09:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration