- Aug
- 2,293
- 111
Code:
_x64: 1
_admin: 1
_elevated: 1
TCC 25.00.20 x64 Windows 10 [Version 10.0.18362.476]
I cannot get the @smwrite function to work unless it is called from a subroutine.
Rem out the Gosub GSLoop and quit, and it returns
Code:
e:\utils>smtest
@smopen hnd: 3988
TCC: (Sys) E:\Utils\smtest.btm [10] The handle is invalid.
"%@smwrite[3988,0,a,Step 1]"
TCC: (Sys) E:\Utils\smtest.btm [10] The handle is invalid.
"%@smwrite[3988,10,a,Step 2]"
TCC: (Sys) E:\Utils\smtest.btm [10] The handle is invalid.
"%@smwrite[3988,20,a,Step 3]"
...for each iteration.
Can anyone else reproduce this, or have my tired eyes missed something?
Joe
Code:
@setlocal
@echo off
Gosub GSLoop
quit
set hnd=%@smopen[10000,"Test"] > nul
echo @smopen hnd: %hnd
set ptr=0
Do kount=1 to 1000
set theString=Step %@formatn[4.0,%kount]
echo %@smwrite[%hnd,%ptr,a,%theString] > nul
::echo %@smread[%hnd,%ptr,a,%@len[%theString]]
set ptr=%@eval[%ptr+10]
enddo
echo @smclose hnd: %@smclose[%hnd]
endlocal
quit
:GSLoop
set hnd=%@smopen[10000,"Test"] > nul
echo @smopen hnd: %hnd
set ptr=0
Do kount=1 to 1000
set theString=Step %@formatn[4.0,%kount]
echo %@smwrite[%hnd,%ptr,a,%theString] > nul
::echo %@smread[%hnd,%ptr,a,%@len[%theString]]
set ptr=%@eval[%ptr+10]
enddo
echo @smclose hnd: %@smclose[%hnd]
Return