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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:40:53+00:00 2026-05-29T21:40:53+00:00

I am facing the following code: char buf[100]; char buf2[100]; strcpy( buf, áéíóúç );

  • 0

I am facing the following code:

char buf[100];
char buf2[100];
strcpy( buf, "áéíóúç" );
sprintf(buf2, "%s", buf);

And I was wondering if it is correct or not. I’ve tested it in Windows and Linux and it did work, but will it work in all OS/platform of different languages?

Both strcpy and sprintf expects a C-string terminated by a null character, but can the content of the C-string be anything (excluding the null character)?

Is it ok to also do something like:

strcpy( buf, "\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00" );
sprintf(buf2, "%s", buf);

?

  • 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-29T21:40:54+00:00Added an answer on May 29, 2026 at 9:40 pm

    A char array is just an array of bytes, and all the non-wide string functions operate on that assumption. The only byte in general that has a special meaning is the null byte.

    The C standard, as far as I can remember, doesn’t have much to say on the subject of character encodings (or text in general), so your program is bound to fail on a platform where the expected output character encoding doesn’t match your code.

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

Sidebar

Related Questions

I am beginner for regular expression. so facing following problem. my code is as
this time, I'm facing a really weird problem. I've the following code: $xml =
Hi i'm facing the following problem, i have to re-write an existant code to
I'm trying to run the following code but unfortunately facing Error problems package jskypeexample;
The following code is for authenticating to a windows AD server using Java+Kerberos and
I am facing the following Prolog code. The expression [X]>>Y stands for the lambda
I am facing problem in big decimal no. Following code snippet will explain my
I am facing problme in rotating image Following code works fine Matrix matrix =
I am facing one problem in the following code , Form is going to
I am facing trouble with Node.getTextContent() of org.w3c.dom. I have following code block: String

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.