TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: CHRIS ADAMS
from: MIKE PARKER
date: 1995-06-19 21:48:00
subject: Re: Example code...

CA> PercentDone!=BytesCopied&/BytesTotal&
CA> LOCATE 1,1:PRINT "(";PercentDone!"%)";
This will give you:
None done:
( 0 %)
All done:
( 1 %)
I dunno why, btu I always useta think that being completed meant 100%...
]
--- Renegade v5-31 Exp
---------------
** A related thread FOLLOWS this message.

FIDO MESSAGE AREA==> TOPIC: 214 POWER BASIC   Ref: CB2G0637 Date: 07/02/95
From: KURT KUZBA                                            Time: 12:10pm
\/To: MIKE PARKER                                         (Read 3 times)
Subj: R: Re: Example code...

MP> JT>  Looking for some PB code that does a "percent bar"
MP>  That's simple. All you need to know is the total value
MP>  (when it's done), current value, and length of bar.
mp>........................................................
   Somebody in the QuickBasic ECHO was just asking about a way
to speed up a program to scan a file for a given character and
I came up with this, which also compiles and runs in PB31.
It's not too bad for a 44 line program.
' [=-----=]   -begin-   CHRCOUNT.BAS   [=-----=]
' [  This program will search any file for instances of
' [  a given character and report the number of times the
' [  character was found. (Includes a progress bar SUB :)
' [  Released to the Public Domain    by     Kurt Kuzba
' [=-----=] [=-----=] [=-----=] [=-----=] [=-----=] [=-----=]
DECLARE SUB Progress (Total&, Remain&)
ON ERROR GOTO OOps
FileName$ = "": COLOR 2, 0: CLS : LOCATE 3, 1
INPUT " Enter file name => ", FileName$
IF FileName$ = "" THEN END
INPUT " ASCII value of character to find => ", char%
IF char% = 0 THEN END:  ELSE char$ = CHR$(char%)
OPEN FileName$ FOR BINARY AS #1
flen& = LOF(1)
PRINT flen&; "bytes in "; FileName$
buf& = flen&
buflen% = 1024
Hits& = 0
PRINT TIME$
WHILE buf& > buflen%
   test$ = STRING$(buflen%, " ")
   GET #1, LOC(1) + 1, test$
   buf& = buf& - buflen%
   GOSUB TestString
WEND
test$ = STRING$(buf&, " ")
GET #1, LOC(1) + 1, test$
buf& = 0
GOSUB TestString
CLOSE 1: PRINT " Hits ="; Hits&: PRINT TIME$: END
TestString:
   WHILE INSTR(test$, char$)  0
      Hits& = Hits& + 1
      test$ = MID$(test$, INSTR(test$, char$) + 1)
   WEND
   Progress flen&, buf&
   RETURN
OOps:
   PRINT " Disk error or bad file name ["; ERR; "]"
   CLOSE 1: END
SUB Progress (Total&, Remain&)
   x = CSRLIN: y = POS(0)
   COLOR 15, 5: LOCATE 1, 1: PRINT "*";
   done% = ((Total& - Remain&) / Total&) * 70
   display$ = STRING$(70, " ")
   MID$(display$, 1) = STRING$(done%, "°")
   COLOR 14, 4: PRINT display$; : COLOR 15, 5
   PRINT "*"; STR$(INT(done% / 70 * 100)); "%";
   COLOR 2, 0: LOCATE x, y
END SUB
' [=-----=]   --end--   CHRCOUNT.BAS   [=-----=]

---
> ] People with glass heads shouldn't.. Ummm.. I forgot.........

---------------
>>>>>>>>>>>>>>>>>>>>>> LAST Message In Thread <<<<<<<<<<<<<<<<<<<<<<

FIDO MESSAGE AREA==> TOPIC: 214 POWER BASIC   Ref: CAW00005 Date: 06/19/95
From: MIKE PARKER                                           Time: 09:50pm
\/To: RONALD BROWN                                        (Read 4 times)
Subj: Re: graphics telecom prog

RB> ings. The name of the program is DRAWBAS10.zip and is located on the ftp 
si
I bet it came out DRAWBAS1.ZIP... DOS cuts things off at 8 chars... Sheesh. 
e
can program but he can't count... Go figure!
--- Renegade v5-31 Exp
---------------
* Origin: The Lighthouse in the Wilderness.. (1:326/405)
* Origin: The Lighthouse in the Wilderness.. (1:326/405)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.