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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:23:21+00:00 2026-05-27T16:23:21+00:00

I am coding a Console Application in c++ and I need to make something

  • 0

I am coding a Console Application in c++ and I need to make something like a “loading.gif” just by using ASCII characters.

The following is the list of the characters that I should be using:

  1. —
  2. \
  3. |
  4. /
  5. —

These symbols will make a loading animation by cycling.

However, when I write the output, it become like:

Output line 1: —
Output line 2: \
Output line 3: |
Output line 4: /
Output line 5: —

I need to do this like this:

Output line 1: [this will be replaced all the time]

It should never go to the second line.

How can I do this in C++? Is there any kind of replace function?

  • 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-27T16:23:21+00:00Added an answer on May 27, 2026 at 4:23 pm

    You can use the backspace character ('\b') to go back and overwrite characters on the console. You’ll also need to flush the output after each change, otherwise the output might stay in a buffer and not appear on the console.

    Here is a simple example:

    #include <iostream>
    #include <unistd.h> // for sleep()
    
    int main()
    {
        std::cout << '-' << std::flush;
        for (;;) {
            sleep(1);
            std::cout << "\b\\" << std::flush;
            sleep(1);
            std::cout << "\b|" << std::flush;
            sleep(1);
            std::cout << "\b/" << std::flush;
            sleep(1);
            std::cout << "\b-" << std::flush;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am coding an unmanaged C++ console application on Windows 7 using Visual Studio
I needed to make a console application using nettiers class libraries. I created a
I'm using Visual Studio C# Express 2010 to make a console application. I've implemented
I'm a C newbie and I was just trying to write a console application
I'm really having trouble closing my console application with FreeGLUT. I would like to
I have a console application I'm using to run scheduled jobs through windows scheduler.
I have just finished writing my c# console application, and I am contemplating embedding
I'm working on a client/server application in C#, and I need to get Asynchronous
I am writing a simple console application in Objective-C but I have heard that
I have a very simple console application that creates a text file. Below is

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.