The QBasic Forum     RULES     Other Subforums, Links and Downloads    Index of Threads

 Return to Index  

Eraser.BAS - ?Permanently? erase files.

January 14 2007 at 11:25 PM
  (Login ComputerGhost)
R


Response to I dug out an old computer today, and found several old programs.

DECLARE SUB BinaryF ()
DECLARE SUB TextF ()
SCREEN 0: WIDTH 80: CLS
LOCATE 25
PRINT "Made by Nathan Belue(ComputerGhost)."
LOCATE 1
PRINT "This program is just based on a theory. It may or may not work."
COLOR 30
PRINT "WARNING!";
COLOR 15
PRINT " This program will erase the files that you tell it to erase-COMPLETELY!"

COLOR 7
PRINT "Continue? [Y|N]"
10 DO: cmd$ = UCASE$(INKEY$): LOOP UNTIL cmd$ <> ""
IF cmd$ = "N" OR cmd$ = CHR$(27) THEN CLS : END
IF cmd$ <> "Y" THEN GOTO 10

CLS
LOCATE 3: PRINT "EXE, COM, BMP, WAV, and most other files similar to these are in BINARY format."
PRINT "BAT, TXT, and most other files similar to these are in Text format."
LOCATE 1
COLOR 15
PRINT "What format is the file that you want to erase in? ["; : COLOR 14: PRINT "B"; : COLOR 15: PRINT "INARY | ";
COLOR 14: PRINT "T"; : COLOR 15: PRINT "ext]";
COLOR 26: PRINT "*"
20 DO: cmd$ = UCASE$(INKEY$): LOOP UNTIL cmd$ <> ""
IF cmd$ = "B" THEN BinaryF
IF cmd$ = "T" THEN TextF
IF cmd$ = CHR$(27) THEN END
GOTO 20

SUB BinaryF
COLOR 15, 1
CLS
LINE INPUT "The full name of the file to erase is:", file$
OPEN file$ FOR BINARY AS #1
IF LOF(1) = 0 THEN
COLOR 14
PRINT "The File Name is Incorrect!"
CLOSE #1
KILL file$
SLEEP
COLOR 7, 0: CLS
END
END IF
COLOR 15
LOCATE 10
PRINT "Number of write-overs:"
PRINT "Size of file in bytes:"; LOF(1)
FOR i% = 1 TO 100
LOCATE 10, 23
PRINT i%
SEEK 1, 1
DO
IF INKEY$ <> "" THEN EXIT FOR
a$ = CHR$(INT(RND * 256))
PUT #1, , a$
LOOP UNTIL SEEK(1) >= LOF(1)
NEXT i%
CLOSE #1
KILL file$
COLOR 7, 0: CLS
BEEP
PRINT "Number of write-overs:"; i% - 1
timers = TIMER
DO: LOOP UNTIL INKEY$ <> "" OR timers + 2 < TIMER
END
END SUB

SUB TextF
COLOR 15, 1
CLS
LINE INPUT "The full name of the file to erase is:", file$
OPEN file$ FOR RANDOM AS #1
IF LOF(1) = 0 THEN
COLOR 14
PRINT "The File Name is Incorrect!"
CLOSE #1
KILL file$
SLEEP
COLOR 7, 0: CLS
END
END IF
COLOR 15
LOCATE 10
PRINT "Number of write-overs:"
PRINT "Size of file in bytes:"; LOF(1)
FOR i% = 1 TO 100
DO
IF INKEY$ <> "" THEN EXIT FOR
a$ = CHR$(INT(RND * 256))
PUT #1, , a$
LOOP UNTIL EOF(1)
NEXT i%
CLOSE #1
KILL file$
COLOR 7, 0: CLS
BEEP
PRINT "Number of write-overs:"; i% - 1
timers = TIMER
DO: LOOP UNTIL INKEY$ <> "" OR timers + 2 < TIMER
END
END SUB


 
 Respond to this message