Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6555233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:47:40+00:00 2026-05-25T12:47:40+00:00

I just got this book Exploring C++ and I’m on my first lesson. I’ve

  • 0

I just got this book “Exploring C++” and I’m on my first lesson. I’ve been doing C# for a couple years as a hobby so i though why not give C++ a try.

In the book it says i need to setup my compiler to use standard C++. I am using visual studio 2010 so i did. http://msdn.microsoft.com/en-us/library/ms235629.aspx

but when i go to compile the code it all works fine except for one if statement.

i have triple checked just as instructed so it must be something with the tools.

specifically

if (not in) // this line here
{
    std::perror(argv[1]);
    return EXIT_FAILURE;

}

The full sample

#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <ostream>
#include <string>
#include <vector>

void read(std::istream& in, std::vector<std::string>& text)
{
    std::string line;
    while (std::getline(in, line))
        text.push_back(line);
}

int main(int argc, char* argv[])
{
    std::vector<std::string> text;

    if (argc <2)
        read(std::cin, text);
    else 
    {
        std::ifstream in(argv[1]);
        if (not in)
        {
            std::perror(argv[1]);
            return EXIT_FAILURE;

        }
        read(in,text);
    }

    std::sort(text.begin(), text.end());

    std::copy(text.begin(), text.end(),
        std::ostream_iterator<std::string>(std::cout, "\n"));
}

I would really like to continue with this book so any help is greatly appreciated.

And I apologize if this is awfully noobish of me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:47:41+00:00Added an answer on May 25, 2026 at 12:47 pm

    not is an “alternative token” for the boolean operator !.

    Perhaps your compiler doesn’t support it.

    Try this instead:

    if (!in)
    

    Indeed, here’s exactly the same issue on another site.

    VC compiler doesn’t by default recognize alternative tokens (they are exceedingly rare nowadays), but I believe this support may be turned on with a compiler switch.

    In fact, Visual Studio requires that you #include <ciso646> to get support for alternative tokens, even though the C++ Standard states that this should have no effect1. Naughty Visual Studio!

    In any case, you might want to find a better, more modern textbook.

    I recommend these resources.


    1 [n3290: footnote 176]: In particular, including the standard header <iso646.h> or <ciso646> has no effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just installed the first release candidate of Python 3.0 and got this error
I just got this error message: ... from c:/ruby/lib/ruby/gems/1.8/gems/... ... 10 levels... from c:/ruby/lib/ruby/gems/1.8/gems/...
I just got this question on an interview and had no idea how to
I'v just got this error in my app. 2010-04-06 03:58:55.505 EasyPay DPS[6530:207] *** -[NTItems
I got this síngleton cache object and it exposes an IEnumerable property which just
I just got Java5 project that has this error, i tried using Java5 and
I just got help in how to compile this script a few mintues ago
Just got a question about generics, why doesn't this compile when using a generic
I got this code from someone and it works very well, I just want
This has got to be something I just missed, but how do I add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.