VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Restore data from damadged flopy

by Sebastjan Dobnik (2 Submissions)
Category: Debugging and Error Handling
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Have U ever saved something on the flopy that could not be retrived due 2 damadged floppy? U insert flopy and try to copy damadged file. Explorer stops saying: "CANNOT READ DRIVE A:" and even ScanDisk cannot repair errors on disk. Well, you could try my VB solution to this problem. It is very easy, effective, and it works. Ok, output file has some errors, but it is beter to have 99% of your data retrived than 0. Don't u agree?

Inputs
damadged file on floppy
Code Returns
restored file on your local disk

Rate Restore data from damadged flopy

Private Sub Command1_Click()
  Dim Buffer As String
  Dim Location As Single
  Dim Lenght As Single
  Dim ErrCount As Single
  
  
  Open "a:\DamadgedFile.dat" For Binary As #1     'the file that is damadged
  Open "c:\temp\DamadgedFile.dat" For Binary As #2   'copy of damadged file (in my case in folder C:\temp)
  
  Lenght = LOF(1)
  
  On Error Resume Next
  Buffer = Space(1)
  
  For Location = 1 To Lenght
    Get #1, Location, Buffer
    If Err <> 0 Then
      ErrCount = ErrCount + 1
      Debug.Print "ERROR no.: " + Format$(ErrCount) + ". Cannot read data on location" + Format$(Location)
      Buffer = " "  'change damadged data with space
      Err.Clear
    End If
    Put #2, Location, Buffer
  Next
  Close
  x = MsgBox("Done")
  End
  
  'Go to c:\temp\DamadgedFile.dat" and try to open it...
  'most Word, Excel, CDR, jpg, bmp, ..... and other file tipes will open with no
  'significant errors in the content...
  '
  'Well, hope this helps u restore your data...
  
End Sub

Download this snippet    Add to My Saved Code

Restore data from damadged flopy Comments

No comments have been posted about Restore data from damadged flopy. Why not be the first to post a comment about Restore data from damadged flopy.

Post your comment

Subject:
Message:
0/1000 characters