Author |
Topic: console programs converted to BBC Basic Linux (Read 405 times) |
|
mmiscool
New Member
member is offline


Posts: 19
|
 |
Re: console programs converted to BBC Basic Linux
« Reply #6 on: Aug 9th, 2017, 1:30pm » |
|
I don't use any kind of sort functions. Just the serial port and I would need the ability to run an external program and from the command line and capture the result. Similar to the shell$() function in run basic.
The following snippet is one I think you created to add the shell$() function to LB/LBB. It looks windows specific. Code:function shell$(command$)
open "msvcrt" for dll as #msvcrt
command$ = command$ + " > %temp%\lbbcmd.out"
calldll #msvcrt, "system", command$ as ptr, r as long
close #msvcrt
tmp$ = space$(260)
calldll #kernel32, "GetTempPathA", 260 as long, tmp$ as ptr, r as long
open left$(tmp$,r) + "lbbcmd.out" for input as #tmp
shell$ = input$(#tmp, lof(#tmp))
close #tmp
end function
|
| « Last Edit: Aug 9th, 2017, 1:34pm by mmiscool » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: console programs converted to BBC Basic Linux
« Reply #7 on: Aug 9th, 2017, 4:08pm » |
|
on Aug 9th, 2017, 1:30pm, mmiscool wrote:| I don't use any kind of sort functions. Just the serial port |
|
The serial port could be an issue. SDL 2.0 provides no support for serial ports, as far as I am aware. Would you perhaps be able to configure the port from the command line so that your LBB program doesn't need to concern itself with that?
Quote:| I would need the ability to run an external program |
|
What's wrong with the regular LB RUN statement?
Quote:| The following snippet is one I think you created to add the shell$() function to LB/LBB. It looks windows specific. |
|
It would have to be adapted to work on a non-Windows platform, certainly, but I expect you could do that without too much difficulty. Using an absolute file path would make it easier.
Considering all the potential difficulties, I can't see this being a project that it would be sensible to attempt. Too many challenges!
Richard.
|
|
Logged
|
|
|
|
mmiscool
New Member
member is offline


Posts: 19
|
 |
Re: console programs converted to BBC Basic Linux
« Reply #8 on: Aug 10th, 2017, 3:22pm » |
|
The run statement provides no feed back from the program that was ran.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: console programs converted to BBC Basic Linux
« Reply #9 on: Aug 10th, 2017, 5:42pm » |
|
on Aug 10th, 2017, 3:22pm, mmiscool wrote:| The run statement provides no feed back from the program that was ran. |
|
Nor does the 'system' API you listed! The "feedback" comes from redirecting stdout to a file, and then reading that file. You can do that using the RUN command, for example:
Code: run "dir > %temp%\stdout.txt", wait In any case, in Linux (which is the OS we are discussing), the RUN command internally uses the 'system' API so it would work exactly the same as your code.
Richard.
|
|
|
|
|