欢迎您注册加入!这里有您将更精采!
您需要 登录 才可以下载或查看,没有账号?注册
x
本代码采用 crt 实现,为什么呢?因为FB的标准库太坑了,除了混乱的类型以外,也会明显增量程序,并且性能很差。
上代码~
[Visual Basic] 纯文本查看 复制代码 Function GetPathFloder(sInPath As ZString Ptr, sOutPath As ZString Ptr) As Integer
Dim rstr As ZString Ptr = StrRChr(sInPath, 92)
If rstr Then
memcpy(sOutPath, sInPath, rstr - sInPath)
Return -1
EndIf
End Function
Function GetPathFileName(sInPath As ZString Ptr, sOutPath As ZString Ptr) As Integer
Dim rstr As ZString Ptr = StrRChr(sInPath, 92)
If rstr Then
strcpy(sOutPath, rstr + 1)
Return -1
EndIf
End Function
Function GetFileFileType(sInPath As ZString Ptr, sOutPath As ZString Ptr) As Integer
Dim rstr As UByte Ptr = StrRChr(sInPath, 46)
If rstr Then
For i As Integer = 1 To strlen(rstr)
sOutPath[i-1] = toupper(rstr[i])
Next
Return -1
EndIf
End Function
Function GetPathFileType(sInPath As ZString Ptr, sOutPath As ZString Ptr) As Integer
Dim TmpPath As ZString Ptr = malloc(MAX_PATH)
If GetPathFileName(sInPath, TmpPath) Then
If GetFileFileType(TmpPath, sOutPath) Then
free(TmpPath)
Return -1
EndIf
EndIf
free(TmpPath)
End Function |