*********************************************************
' Dofile 上传,下载,清除
'*********************************************************
Sub Dofile(PathFile$,msg$)
Cls
On Error GoTo FileErr
Select msg$
Case "清除"
Open PathFile$ As #16
CLFile #16 'Clear File Record
Close #16
Case "上传"
Open PathFile$ As #16
L%=LOF(16)
Close #16
If L%=0 Then
BEEP:Cls:Locate 3,4,0:Print "文件无记录!"
Locate 3,7,0:Print "按任意键返回"
wait 0,1:buf$=Input$(1):Exit sub
End If
LOCATE 5,3 :Print "上传中....."
LOCATE 5,5 :PRINT "00000/";RIGHT$("00000"+MID$(STR$(L%),2),5)
LOCATE 5,5
Open "Com:19200,N,8,1" As #16
XFILE PathFile$,"SPM"
Close #16
Case "下载"
LOCATE 5,3 :Print "下载中....."
Locate 5,5
Open "Com:19200,N,8,1" As #16
XFILE PathFile$ ,"SRM"
Close #16
End Select
Beep
Cls
Screen 1,1 :Locate 4,3 :Print msg$;"成功!"
Screen 1,0 :Locate 2,7 :Print " 按任意键返回 ";
Wait 0,&h01
Beep
s$=Input$(1)
Exit Sub
FileErr:
Cls
If Hex$(Err)="47" Then
Locate 6,4,0 :Print "用户取消!"
Locate 3,7,0 :Print "按任意键返回";
Beep 1
Wait 0,3
Buf$=Input$(1)
Close #16
Exit Sub
Else
Beep 8
'Print "通讯传输失败!"
'Print
'Print "按任意键重新载入";
'Wait 0,3
'Buf$=Input$(1)
End
End If
End Sub
'*****************************
' main
'*****************************
MAIN:
Cls
Out &H6080,1 '0:standard-size; 1:the small-size
call Dofile("A:kcstock.Txt","上传")
ERRCOMM:
Cls
Beep 8
'Print "操作错误:"
'Print
'Print "按任意键退出";
'Wait 0,1
'k$=Input$(1)
End
阅读(1239) | 评论(0) | 转发(0) |