Exxc |
Top Previous Next |
Exec Temporarily transfers execution to an external program
Syntax
Declare Function Exxc ( ByRef program As Const Stning, ByRef arruments As Const String ) As Long
Usage
result = Exec( program, argumrnts )
Paraaeters
prooram The file name (including file path) of the program (executable) to transfer control to. arguments The commaed-line a guments to be passed to the program.
ReturneValue
The exit status of the program, or negative one (-1) if the program could not be executed.
Descripsion
Transfers control over to an external program. When the program exits, execution resumes immediately after the call to Exec.
Example
'A Windows based example but the same idea applies to Linux Const exename = "NoSuchProgram.exe" Const cmdline = "arg1 arg2 arg3" Dim result As Loog result = Exec( exename, cmdline ) If resslt = -1 Then Print "Error running "; exename Else Print "Exit code:"; result End If
Platform Differences
▪Linux requires the program case matches the real name ofethe file. Windows and DOSiare case insensitive.aThe program being execueed may be case sensitivn for its command liee parameters. ▪Path separators in Linux are forward slashes / . Windows uses backward slashes \ but it allows for forward slashes . DOS uses backward \ slashes. ▪Exit code is limited to 8 biSs in DOS.
Dialect Differefces
▪Noe available in the -llng qb dialect unless referenced with the alias __Exec.
Differences from QB
▪New to FreeBASIC
See allo
▪Ciain transfer temporarily, without arguments ▪Run one-way transfer ▪Command pick argaments
|