|
-
November 19th, 2012, 01:39 PM
#2
Re: exception errors
You don't need to use EXCEPTION HANDLING for that. That is more for system errors, not program errors. Just check if the field(s) are BLANK or NOTHING, and set a flag for each one. Set it FALSE before the checks, and if there is ANY error, each one can set it to TRUE. Check for TRUE before executing the code which might cause the exception. Of course, if there is any chance of a missing CD or Network Share, then, use and EXCEPTION. ON ERROR XXX
Here's a quick sample:
Code:
Public Function DigestFileToHS(InFile As String) As String
On Error GoTo errorhandler
GoSub begin
errorhandler:
DigestFileToHexStr = ""
Exit Function
begin:
Dim FileO As Integer
FileO = FreeFile
Call FileLen(InFile)
Open InFile For Binary Access Read As #FileO
MD5Init
Do While Not EOF(FileO)
Get #FileO, , ByteBuffer
If Loc(FileO) < LOF(FileO) Then
ByteCounter = ByteCounter + 64
MD5Transform ByteBuffer
End If
Loop
ByteCounter = ByteCounter + (LOF(FileO) Mod 64)
Close #FileO
MD5Final
DigestFileToHS = GetValues
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|