Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: write progress to stdout while indexing #52

Open
stax76 opened this issue Apr 1, 2016 · 0 comments
Open

feature request: write progress to stdout while indexing #52

stax76 opened this issue Apr 1, 2016 · 0 comments

Comments

@stax76
Copy link

stax76 commented Apr 1, 2016

It would be a valuable feature if L-SMASH-Works would print progress to stdout.

I've asked DG how he does it in DGIndexNV, his answer:

void OutputProgress(int progr)
{
    static int lastprogress = -1;

    if (progr != lastprogress)
    {
        char percent[20];
        DWORD written;

        sprintf(percent, "%d\r", progr);
        WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), percent, (DWORD) strlen(percent), &written, NULL);
        lastprogress = progr;
    }
}

This is important too for an implementer:

"Every 30 frames, this function is called to write to stdout"

and

progr is an int 0-100 indicating the percent completed.
The caller determines the percent complete from the ratio
of the current file position and the size of the file.
That way you don't need to know the number of frames in the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant