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

  • Home
  • SEARCH
  • 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 107547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:46:17+00:00 2026-05-11T01:46:17+00:00

I am creating a small console app that needs a progress bar. Something like…

  • 0

I am creating a small console app that needs a progress bar. Something like…

Conversion: 175/348 Seconds   |==========          |  50% 

My question is, how do you erase characters already printed to the console? When I reach the 51st percentage, I have to erase this line from the console and insert a new line. In my current solution, this is what happens…

Conversion: 175/348 Seconds   |==========          |  50% Conversion: 179/348 Seconds   |==========          |  52% Conversion: 183/348 Seconds   |==========          |  54% Conversion: 187/348 Seconds   |===========         |  56% 

Code I use is…

print 'Conversion: $converted_seconds/$total_time Seconds   $progress_bar  $converted_percentage%\n'; 

I am doing this in Linux using PHP(only I will use the app – so please excuse the language choice). So, the solution should work on the Linux platform – but if you have a solution that’s cross platform, that would be preferable.

  • 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-11T01:46:17+00:00Added an answer on May 11, 2026 at 1:46 am

    I don’t think you need to apologize for the language choice. PHP is a great language for console applications.

    Try this out:

    <?php for( $i=0;$i<10;$i++){   print '$i \r';   sleep(1); } ?> 

    The ‘\r’ will overwrite the line with the new text. To make a new line you can just use ‘\n’, but I’m guessing you already knew that.

    Hope this helps! I know this works in Linux, but I don’t know if it works in Windows or other operating systems.

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

Sidebar

Ask A Question

Stats

  • Questions 60k
  • Answers 61k
  • 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
  • added an answer My personal belief is that you should design the database… May 11, 2026 at 9:35 am
  • added an answer This recommendation comes from the best practice of 'separation of… May 11, 2026 at 9:35 am
  • added an answer Have a look at that list of Code Coverage Tools… May 11, 2026 at 9:35 am

Related Questions

I am creating a small console app that needs a progress bar. Something like...
I am creating a small modal form that is used in Winforms application. It
I am creating a small application that will be deployed on Window. The database
I am creating a small app to teach myself ASP.NET MVC and JQuery, and
I am creating a small silverlight widget which pronounces a word and highlights each
I am planning on creating a small website for my personal book collection. To
I have a small calculator that I am creating in C# (Sharp Develop). The
I am creating a program that will be installed using the .net installer project.
I am creating a GUI for a machine that runs remote (WinXP) or on
I am creating a Windows Service in C# that processes messages from a queue.

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.