Wipe file data information completly PB 3.2 
Author Message
 Wipe file data information completly PB 3.2

Hi!

Maybe someone could point me to which MS-DOS API function I should look into
if I wanted to do as subjected.

Tia

Tom



Thu, 07 Apr 2005 06:08:38 GMT  
 Wipe file data information completly PB 3.2

Quote:
> Hi!

> Maybe someone could point me to which MS-DOS API function I should look
into
> if I wanted to do as subjected.

Why bother with the int x'21' functions?

hFile = FREEFILE
OPEN 'thefile" FOR BINARY AS hFile
DIM B AS BYTE
B = 0?
L = LOF(hFile)
SEEK hFile, 0
FOR I = 1 TO L
  PUT hFile,,B
NEXT
CLOSE hFile

Overwrites all bytes of file with binary zeroes. KILL file. Someone resets
the deleted byte in the FAT, big deal, all they can do now is read a file
full of nuls.

(Lots of optimizations available).

MCM



Thu, 07 Apr 2005 07:00:23 GMT  
 Wipe file data information completly PB 3.2

Quote:

>On Sat, 19 Oct 2002 23:00:23 GMT, "Michael Mattias"
>>Overwrites all bytes of file with binary zeroes. KILL file. Someone resets
>>the deleted byte in the FAT, big deal, all they can do now is read a file
>>full of nuls.

>>(Lots of optimizations available).

>for example, it would be a LOT faster if you write a string of nulls rather
>than each byte individually. (Especially with large files)
>--
>Marc van den Dikkenberg

Somewhere in PB there is a variable or function that will tell you how big
a string may be. Its been a while since I've used it but it should be used
instead of the %MaxChunk constant. Look in help for the pbVariables. I think
it's in there.

Also, if you REALLY want to do this correctly then you should make at least
3 passes using zero and 255 alternately for the value.

%MaxChunk = 32768
%Passes   =     3

FileNo% = FREEFILE
OPEN FileName$ FOR BINARY AS #FileNo%
FOR X = 1 TO %Passes
  Bytes&  = LOF(FileNo)
  C? = (C? XOR 255)
  Buffer$ = STRING$(%MaxChunk,C?)
  SEEK #FileNo%, 0
  WHILE Bytes& > 0
    Chunk& = MIN&(Bytes&,%MaxChunk)
    Bytes& = Bytes& - Chunk&
    IF Chunk& < %MaxChunk THEN
      Buffer$ = STRING$(Chunk&,C?)
    END IF
    PUT$ #FileNo, , Buffer$
  WEND
NEXT      
CLOSE #FileNo    
--
C'ya,
Don


www.DASsoftVSS.com
www.BASICguru.com



Thu, 07 Apr 2005 14:04:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Redirection PB 3.2

2. Subs vs Functions PB 3.2

3. Printer Ready PB 3.2

4. Dynamic Arrays in PBU's PB 3.2

5. Dates PB 3.2

6. PB 3.2 program needed

7. data alignment/symbol duplication (xlf 3.2/AIX 4.1.4)

8. I need the file wcc386p.exe of Watcom 3.2

9. Clipper: File loking / closing problem w NetWare 3.2

10. ANNOUNCE: IndexMaker 3.2: an index.html maker from PDF, HTML, VRML and other files

11. Don't know how to make a exe file in MFCobol 3.2

12. MF Cobol 3.2 Can't Open a File

 

 
Powered by phpBB® Forum Software