У меня есть приложение командной строки, закодированное в delphi, которое мне нужно вызвать из обычного настольного приложения (также закодированного в delphi). Короче говоря, я хочу вызвать приложение командной строки и отобразить текст, который он выводит "live" в списке.
Прошло много времени с тех пор, как я играл с оболочкой, но я отчетливо помню, что для того, чтобы захватить текст из приложения командной строки, я должен использовать символ трубы " > ". Вот так:
C:/mycmdapp.exe > c:/result.txt
Это приведет к тому, что любой текст будет напечатан в оболочке (с использованием writeLn) и выгрузите его в текстовый файл под названием "result.txt".
Но.. (и вот идет рассол), мне нужен живой результат, а не файл журнала. Типичным примером является сам компилятор Delphi, которому удается сообщать обратно в среду IDE, что происходит. Если моя память правильно меня обслуживает, мне кажется, что я должен создать канал "pipe" (?), А затем назначить имя канала вызову оболочки.
Я попытался это сделать, но я, честно говоря, не знал, как его сформулировать. Надеюсь, кто-то из сообщества может указать мне в правильном направлении.
Обновлено. Этот вопрос может быть идентичным Как запустить программу командной строки в Delphi?. Некоторые ответы соответствуют тому, что я ищу, хотя сам титул и сам вопрос не идентичны.