Task
Execute a system command and get its output into the program. The output may be stored in any kind of collection (array, list, etc.).




Related task
  Execute a system command


If OpenConsole("ls")
  rp=RunProgram("ls", "-l", "",#PB_Program_Open|#PB_Program_Read)  
  While ProgramRunning(rp)
    If AvailableProgramOutput(rp)
      r$+ReadProgramString(rp)+#LF$
    EndIf
  Wend
  CloseProgram(rp)
  PrintN(r$)
  Input()
EndIf
 