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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:31:42+00:00 2026-06-10T09:31:42+00:00

I was recently writing a simple c++ program involving sockets. It had been a

  • 0

I was recently writing a simple c++ program involving sockets. It had been a while since I worked with c++, so i was doing some simple sanity checking to make sure my classes were properly constructed. I encountered a very strange error then. When I did not have \n or endl at the end of my output to console, it would not write to console. For example:

This would not output to console

class Server{
    public:
        Server(){
            std::cout << "STARTING SERVER";
        }
};

This would:

class Server{
    public:
        Server(){
            std::cout << "STARTING SERVER" << std::endl;
        }
};

Both were created using Server server;. Was this just a ‘ghost’ in my computer or has anyone encountered this before?

  • 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-10T09:31:44+00:00Added an answer on June 10, 2026 at 9:31 am

    That’s normal. It’s stored in the buffer until the buffer is flushed. You can send std::flush to the stream to flush it. You can use std::endl to write an end of line and flush the buffer. It’s basically an optimization to avoid large numbers of I/O operations if you write lots of small things to a stream.

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

Sidebar

Related Questions

I've been recently writing simple game in C++ with SFML. Here's my question: In
I was writing a simple for loop recently and got some unexpected behavior: for(double
It's been a while since I've had to do any HTML-like code in Vim
I'm writing a simple static library for myself recently. It include some ui control,
I was recently writing some OpenGL 3.3 code with Vertex Array Objects (VAO) and
Recently I spent quite some time writing various Visual Studio Extensions projects. Even though
Recently, I started writing a program to compare DNA sequence. As the alphabet only
I have been recently writing a UDP server for a 2D shooter game I
I was recently writing a program in Objective-C and I tried the wrote the
I am writing a simple soccer game in cocos2d-x and recently found out that

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.