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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:06:00+00:00 2026-05-10T22:06:00+00:00

In an Xcode project, if I use std::cout to write to the console the

  • 0

In an Xcode project, if I use std::cout to write to the console the output is fine.

However, if I use std::wcout I get no output.

I know that this is a thorny issue in C++, and I’ve been googling around to try and find a specific solution in the Xcode case. A couple of things I found that it was suggested should work were:

std::cout.imbue( std::locale('') ); 

and

std::setlocale(LC_ALL, ''); 

Neither of these have made any difference. Before I resign myself to spending the next couple of weeks studying the facets API just to be able to write to the console I thought I’d check with the esteemed audience here.

[Update]

I think the reason for the problem I’ve been having is actually to do with the specific encoding of some of the strings I’m trying to print.

If I send just a string literal, using the L'my string' syntax it works! It appears this is using UTF32 – little endian encoding.

However, I’ve been mixing this with strings I’ve been passed from Objective C++ code using NSUTF32BigEndianStringEncoding encoding. It’s this mix of encodings that’s causing the problems.

I think we can consider this matter closed. Thanks for reading.

  • 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. 2026-05-10T22:06:00+00:00Added an answer on May 10, 2026 at 10:06 pm

    std::wcout should work just like std::cout.

    The following works fine on my MAC:

    #include <iostream>  int main() {     std::cout << 'HI' << std::endl;     std::wcout << L'PLOP' << std::endl; } 

    Maybe (though some code would have been nice) its because you are not flushing the buffer. Remember that std::cout and std::wcout are buffered. This means the output will not be pushed to the console until the buffer is filled or you explicitly flush the buffer.

    You can flush the buffer with:

    std::wcout << flush(); // or std::wcout << endl;  // Those also puts a '\n' on the stream. 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 84k
  • Answers 84k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's the KB article for that error. Here's another interesting… May 11, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer I suspect the place to start looking will be at… May 11, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer What you are getting is not a webpage but an… May 11, 2026 at 5:02 pm

Related Questions

Is it possible to have a C static library API, which uses C++ internally
I'd like to start experimenting with Cocoa and programming for Mac OSX. I'm not
I have an Xcode project and needed to change the name of the product
I have an Xcode project with the following group structure: ProjectName/ Classes/ class1.h class1.m

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.