GithubHelp home page GithubHelp logo

oysteijo / progressbar Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 16 KB

Simple yet functional progressbar in ANSI C for ascii terminals

License: BSD 2-Clause "Simplified" License

Makefile 3.03% C 96.97%

progressbar's Introduction

Progress bar in ANSI C for ascii terminals

progreesbar.png

This is a really simple progressbar implementation in ANSI C99. I want it to be beautiful yet simple. General yet not requiring much configuration.

Super simple API. Only one function:

#include "progress.h"
#define MAX_COUNT 100
int main()
{
    for(int i=0; i <= MAX_COUNT; i++ ){
        /* Do something */
        progress_ascii( i, MAX_COUNT, "Some text: ");
    }
    return 0;
}

I have added some flexibility in the leading text by having the function variadic, just like a printf() You can hence call the function like:

        progress_ascii( i, maxvalue, "(%4d/%4d) ", i, maxvalue);

Estimated time

I have added the feature to estimate the ETA of a long process. This feature sets a start time when the call to progress_ascii() gets 0 as it first argument.

Please note that you probably want to call the function with a final 100% value as well. In that case the total spent time is reported.

So... Make sure that you call the function with both 0 at start and 100%-value at the end.

progressbar's People

Contributors

oysteijo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.