2

Possible Duplicate:
How to get the dos output. In delphi2009 with vista.

I am using Createprocess() in order to verify a certificate with openssl. I want to redirect the answer so that i don;t have to write it in a .txt and read it from there. I want to redirect it to a string directly. The basic code is the following:

CreateProcess(
    nil,
    'CMD /C C:\openssl\bin\openssl verify C:\myCA\Certificat.crt > C:\certificat\outdelphi.txt',
    nil, nil,False,
    CREATE_NEW_PROCESS_GROUP+NORMAL_PRIORITY_CLASS,
    nil, 'c:\', ShowInfo, ProcInfo
);
Sleep(1000);

i don't want to use the >C:\certificat\outdelphi.txt. I want the output to be redirected to a string. How can i do it ?

Community
  • 1
  • 1
Dragos
  • 21
  • 1
  • possible duplicate of [How to get the dos output. In delphi2009 with vista.](http://stackoverflow.com/questions/2971266/how-to-get-the-dos-output-in-delphi2009-with-vista) Also [How in Delphi 2009 redirect console (stin, sterr)?](http://stackoverflow.com/questions/841047/how-in-delphi-2009-redirect-console-stin-sterr) – Rob Kennedy Jun 16 '11 at 16:10
  • 4
    @David, for later performance optimization? – Uwe Raabe Jun 16 '11 at 16:21
  • @Uwe Ah. Change it to Sleep(500) and release version 2 with the strap-line, "Now twice as fast!" – David Heffernan Jun 16 '11 at 16:27
  • It is equivalent to `WaitForNoObject(1000); call` – Premature Optimization Jun 16 '11 at 17:53
  • Eew, "dos" term gives me facepalms. Also: is not really correct to link general redirection technique with problems imposed by D2009 migration (potentially breaks at least 2 points if built as unicode) – Premature Optimization Jun 16 '11 at 19:46

0 Answers0