Thread: StaxRip
View Single Post
Old 20th May 2015, 00:29   #183  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Quote:
Originally Posted by videoh View Post
Every 30 frames, this function is called to write to stdout:

Code:
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;
	}
}
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.

Sweet.
Thanks, would be a great improvement for L-Smash-Works, I'll forward it.
stax76 is offline   Reply With Quote