Jump to content

Search the Community

Showing results for tags 'stdin'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hi, I've been writing an app that takes a data feed from Stdin, and while I have it working using the code below, which works fine if you are running it on the commandline ie sendstuff | MyApp However I was trying to get the App to run inside the IDE by first piping the output to a file sendstuff > xxx and then in the run params having "< xxx", but it doesnt see the input as Stdin and you get a stream size of -1. Anyone got any ideas how to be ablue to simulate the stdin properly so I can step through the code in the IDE, debugging via writeln really sucks. Its a windows app atm, will eventually want to expand it so its windows/linux. Im using Delphi 12.2 John. var StdInHandle: THandle; StdInStream: TStream; Buffer: TBytes; BytesRead: Integer; begin StdInHandle := GetStdHandle(STD_INPUT_HANDLE); // Ensure the handle is valid if StdInHandle = INVALID_HANDLE_VALUE then begin WriteErr('Invalid standard input handle.'); Exit; end; try // Wrap the handle in a THandleStream for easier reading StdInStream := THandleStream.Create(StdInHandle); while StdInStream.Position < StdInStream.Size do begin SetLength(Buffer, StdInStream.Size); BytesRead := StdInStream.Read(Buffer, StdInStream.Size); // do stuff end;
×