Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

Streams and commas

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 26 May 2005 09:07 GMT
Hello,

Why does the following code print "fail" instead of "123"
in the vc 2005 beta?

Thanks

-John

#include "stdafx.h"

#include <sstream>

int _tmain(int argc, _TCHAR* argv[])
{
    std::stringstream ss("123,456");

    int x;

    ss >> x;

    if (ss.fail()) {
        printf("fail");
    } else {
        printf("%d", x);
    }

    return 0;
}
ismailp - 27 May 2005 02:29 GMT
what beta do you use?
John Ky - 29 May 2005 12:36 GMT
Beta 2

> what beta do you use?
Jason Murphy - 30 May 2005 12:42 GMT
why do you use "<sstream>"?
Signature

Software is great!!!

> Hello,
>
[quoted text clipped - 25 lines]
>     return 0;
> }
John Ky - 30 May 2005 14:10 GMT
The std::stringstream class is in <sstream>

-John

> why do you use "<sstream>"?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.