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 8192353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:09:34+00:00 2026-06-07T04:09:34+00:00

In xcode 4.3 I have set the project to use c++11: I changed the

  • 0

In xcode 4.3 I have set the project to use c++11: I changed the voice c++ language dialect to c++11, and c++ standard library to “libc++ ( LLVM c++ standard library with c++11 support)”.
Then I tried to compile and execute this simple code:

#include <iostream>

using namespace std;

int main (int argc, char** argv) 
{
    char buffer[100];
    cin.getline(buffer,100);
    cout << buffer << endl;
    return 0;
}

The problem is that it asks two times the input.For example I type “hello” and the stream remains opened, waiting for another string.If I type another string then it prints out “hello”.
If I don’t use c++11 this problem doesn’t occur.
Does anyone know how to solve this problem? I want to take in input maximum 100 characters without using std::string.

  • 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-06-07T04:09:35+00:00Added an answer on June 7, 2026 at 4:09 am

    This is a bug in libc++. My apologies. It is fixed on Mountain Lion. You can work around it by using getline(istream&, string&) instead:

    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main (int argc, char** argv) 
    {
        std::string buffer;
        getline(cin, buffer);
        cout << buffer << endl;
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Xcode project with several static library dependancies set up in the
I have a library project in Xcode 4. I'm building against iOS 4.3. The
I'm new to XCode. I use XCode 3.1.3. In my project, i have on
I have an xcode workspace which is set up with some project libraries which
I have try to set icon for my App in the xCode. In the
I have a problem when I try to set up Xcode . shown in
I have Xcode 4.3 and that class doesn't use ARC. I have created a
I have an Xcode project. The project currently has four targets, and I am
Suppose I have my project using Base SDK = 4 but set the Target
I have an iPhone SDK project that is supposed to build a static library

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.