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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:34:31+00:00 2026-05-24T15:34:31+00:00

I compiled on Ubuntu a program that was developed for (and works on) Windows.

  • 0

I compiled on Ubuntu a program that was developed for (and works on) Windows. On Ubuntu, I see this code:

string s = values_[9];
cout << s << endl;
cout << s << "x\n";

producing this output:

high
xigh

The expected output for the second line is “highx”. I know that the value of values_[9] is originally read from a file (written on Windows). Printing other strings seems to work normally.

What’s going on here?

  • 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-24T15:34:31+00:00Added an answer on May 24, 2026 at 3:34 pm

    Run the command with its output piped through cat -A. Probably either the value of s, or the output produced by endl is giving you a '\r' character, which typically sends the cursor back to the beginning of the line.

    EDIT: On further thought, the stray '\r' is almost certainly in s, not in the output produced by endl. I had thought there might be some funny locale stuff going on, but having s equal to "high\r" explains the symptoms.

    EDIT2: If your system doesn’t have cat -A (it’s a GNU extension), try cat -v or, if you’re desperate, od -c.

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

Sidebar

Related Questions

I have a C program that I'm developing using Ubuntu 11.10 (Linux version 3.0.0-12-generic-pae
I'm compiling an example program that uses opengl in ubuntu (linux). A short snippet
I have ubuntu 11 installed in my system. I have a c program that
I am using gcc (Ubuntu 4.4.1-4ubuntu9) to compile a program that I'm writing, but
i have a simple program which is compiled with gtk2.0 in ubuntu.In ubuntu11.04 i
I am trying to compile my C program in Ubuntu 9.10 (gcc 4.4.1). I
On Ubuntu I compiled sbcl 1.0.35 with threading. I can happily use sbcl from
I have a following problem: I compiled my application on Linux Ubuntu 9.10 using
(My environment is 64-bit Ubuntu, my application is C++ compiled and linked with g++.)
I'm running Ubuntu to compile a set of code which requires python 2.4. How

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.