QB64 Phoenix Edition
Program Solution#1 - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Program Solution#1 (/showthread.php?tid=3749)



Program Solution#1 - eoredson - 06-16-2025

Solves reading * in Command$ returning concatenated filelist:

Code: (Select All)
Print Command$(0)
C$ = Read.Command$
Print "Commandline="; C$
End

Rem get command$
Function Read.Command$
  Declare Library
      Function GetCommandLineA%& ()
  End Declare
  Dim m As _MEM, ms As String * 1000
  a%& = GetCommandLineA
  m = _Mem(a%&, Len(ms))
  ms = _MemGet(m, m.OFFSET, String * 1000)
  If a%& Then
      cmd$ = ms
      eol = InStr(cmd$, Chr$(0))
      If eol Then
        cmd$ = Left$(cmd$, eol - 1)
      End If
      ' parse off program name.
      eol = InStr(2, cmd$, Chr$(34)) + 1
      cmd$ = Mid$(cmd$, eol)
  End If
  _MemFree m
  Read.Command$ = cmd$
End Function