Hi Charles,
I had to interrupt my tests yesterday therefore my response is a bit delayed.
There is still a problem with using argv to get the arguments in:
function main cdecl (int argc,char**argv) as int
There is no problem to get the arguments with arga though. Is char**argv the same as string *argv ? Somehow this construct looks like magic to me.
I have tried to arrange the possible variations to retrieve the arguments in OxygenBasic. Perhaps there is something additional to be considered for a C-style main function? To get the arguments outside of main or in main without parameters I applied the code of function f which is commented out in sysutil.inc. Using arga should work in any case.
Roland
$filename "GetCommandArgs.exe"
'#include "$/inc/RTL32.inc"
includepath "$/inc/"
#include "console.inc"
#include "sysutil.inc"
CreateArgv
print"Get Arguments without main function"
string cmd=(char) GetCommandLine
printl "Commandline complete: " : printl cmd
printl ""
printl "Number of Arguments: " argc
for i=1 to argc
printl "Arga[" i "]: " arga[i]
next
'argv
sys i
for i=1 to argc
char c at argv[i]
printl "Argv[" i "]: " c
next
printl ""
function main cdecl (int argc,char**argv) as int
================================================
printl "Get Arguments in: function main cdecl (int argc,char**argv) as int"
for i=1 to argc
printl "Argv[" i "]: " argv[i]
next
for i=1 to argc
printl "Arga[" i "]: " arga[i]
next
printl ""
end function
main argc, byval @argv
function main()
printl "Get Arguments in: function main() without arguments"
for i=1 to argc
printl "Arga[" i "]: " arga[i]
next
'argv
sys i
for i=1 to argc
char c at argv[i]
printl "Argv[" i "]: " c
next
end function
main
printl cr "Enter ..." : waitkey
.