Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

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 on 19 Nov 2009 at 6:01 AM
If I use findfirst or findnext, that will wasting time???
Report
Re: Get progress from scanning Posted by Atex on 20 Nov 2009 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...




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 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.
Operated by CommunityHeaven, a BootstrapLabs company.