Looking for a hosted bug/issue tracker? Try our hosted development tools.

Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 3680
Number of posts: 12858

This Forum Only
Post New Thread

Report
Get progress from scanning Posted by anggi on 11 Nov 2009 at 6:14 AM
I am trying to make simple malware removal, but I dont know how to get the percentage of path that I want to scan. For example I scan c:\folder, I want to get the percentage to make progress bar while scanning.

Thx a lot.
Report
Re: Get progress from scanning Posted by Atex on 13 Nov 2009 at 8:20 PM
Let be m the total number of files in a folder, n the current file you process (a nonzero number) then current percentage (cp) would be: cp:=n*100/m
Report
Re: Get progress from scanning Posted by anggi on 15 Nov 2009 at 9:34 AM
How can I get m ? Do I have to scan twice? :(
Report
Re: Get progress from scanning Posted by Atex on 15 Nov 2009 at 9:50 PM
: How can I get m ? Do I have to scan twice? :(

No, you have to use the findfirst and findnext procedures from the Dos unit to get all the filenames in a folder first. That gives you the m. When you scan you'll have to open each file for scan, starting from 1 (n).
Report
Re: Get progress from scanning Posted by anggi yesterday at 6:01 AM
If I use findfirst or findnext, that will wasting time???
Report
Re: Get progress from scanning Posted by Atex today at 8:43 AM
: If I use findfirst or findnext, that will wasting time???

No time wasting there (takes only a fraction of a second), beside that's the only way to find out the file names from a folder...unless you read the FAT directly and process the info but that's a bit beyond plain Pascal's capability, you'd have to rely on assembly there...




 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.