1

I need to write a FILE to STDIN. This FILE going to be accessed by another EXE that goig to write the STDIN stream in a microcontroller.

Could you give me a help how to write the file to STDIN using Delphi 2010?

Thanks very much!

3
  • 1
    You can read from STDIN and write to STDOUT. Commented Jul 30, 2010 at 20:05
  • @Andreas: I believe he means "write to an output that serves as STDIN for another process." Commented Jul 30, 2010 at 20:12
  • @Mason: Oh, yes, very possible, indeed. Commented Jul 30, 2010 at 20:12

2 Answers 2

3

I think you mean STDOUT.

Is the Allen Bauer's answer is what are you looking for?

Sign up to request clarification or add additional context in comments.

Comments

2

It looks like you're trying to write to some sort of output that the other EXE will see as its STDIN stream. In that case, Allen Bauer's answer mentioned by Serg is close, but it's not going to be enough for you.

There's some sample code on MSDN that explains how to do this, but it's all in C and hard to read. The important part is this:

Call CreatePipe, which is declared in Windows.pas. The first two parameters are var parameters to THandle variables that CreatePipe will fill with the read handle and the write handle of the pipe. Then you need to set up a TStartupInfo record. Assign the read handle to your pipe to the hStdInput field of the TStartupInfo.

You pass the TStartupInfo to CreateProcess to spawn the second EXE, and then you can create a THandleStream like in Allen's example, passing it the write handle of the pipe. That way, anything you write into the stream gets piped to the read end to be read by the other EXE.

Hope that helps...

1 Comment

If the question is about pipes, look at the answers on SO question stackoverflow.com/questions/512366/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.