32 bits version
$ wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-32.tar.xz -O popcorntime.tar.xz
64 bits version
#Progress in C
This is in an example meant to present some ideas regarding command-line progress bars in C.
##Important parts
The main idea is to overwrite stdout
with new information every time a particular step is reached. I accomplished this using the VT100 emulator hack from [this Stack Overflow answer][1]. In a nutshell, printing ^[[2K
to stdout
erases the current line, but it doesn't necessarily move the cursor to the start. Printing \r
does that. Also, I decided I wanted to print a newline character after the progress indicator, but I need to get rid of that newline on the next print. That's what \b
does: it inserts a backspace, deleting the last character printed.
Also important is the call to fflush
, which will guarantee that the print operation completes and is visible before the program moves on to its next task (see [this Stack Overflow answer][2]).
// LoadingScreenManager | |
// -------------------------------- | |
// built by Martin Nerurkar (http://www.martin.nerurkar.de) | |
// for Nowhere Prophet (http://www.noprophet.com) | |
// | |
// Licensed under GNU General Public License v3.0 | |
// http://www.gnu.org/licenses/gpl-3.0.txt | |
using UnityEngine; | |
using UnityEngine.UI; |