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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:07:59+00:00 2026-06-15T09:07:59+00:00

With MSVC 2010 i try to compile this in C or C++ mode (needs

  • 0

With MSVC 2010 i try to compile this in C or C++ mode (needs to be compilable in both) and
it does not work. Why? I thought and found in the documentation that ‘\x’ takes the next two characters as hex characters and not more (4 characters when using \X”).

I also learned that there is no portable way to use character codes outside ASCII in C source code anyway, so how can i specify some german ISO-8859-1 characters?

int main() {
     char* x = "\xBCd";  // Why is this not char(188) + 'd'
}

// returns  test.c(2) : error C2022: '3021' : too big for character
// and a warning with GCC
  • 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-15T09:08:01+00:00Added an answer on June 15, 2026 at 9:08 am

    Unfortunately you’ve stumbled upon the fact that \x will read every last character that appears to be hex1,2, instead you’ll need to break this up:

    const char *x = "\xBC" "d"; /* const added to satisfy literal assignment probs */
    

    Consider the output from this program:

    /* wide.c */
    #include <stdio.h>
    int main(int argc, char **argv) 
    {
        const char *x = "\x000000000000021";
        return printf("%s\n", x);
    }
    

    Compiled and executed:

    C:\temp>cl /nologo wide.c
    wide.c
    
    C:\temp>wide
    !
    
    1. Tested on Microsoft’s C++ compiler shipped with VS 2k12, 2k10, 2k8, and 2k5
    2. Tested on gcc 4.3.4.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code compiles fine with GCC and Clang but not with MSVC 2010: #include
std::string s(foo); sprintf(buf,%s,s); Why at least under MSVC 2010 this line of code doesn't
I recently switched to Linux and wanted to compile my Visual Studio 2010 C++
I develop application in C# with MSVC 2010 Express, with Forms/WPF/etc. Application consist of
I've added a combo box in the gui editor in MSVC 2010 pro in
I'm trying to build my application with MSVC 2010 instead of GCC. With GCC
I am trying to compile Qt 4.7.4, but I always get this error: mt.exe:
Here's the implementation of std::bitset::count with MSVC 2010: size_t count() const { // count
This question may sound like for beginners, however when I found that out I
I use MSVC 2010 SP1 and I have the following line of C++ code:

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.