Results 1 to 6 of 6

Thread: Programming a Printer Pipe?

  1. #1
    Member
    Join Date
    Mar 11
    Posts
    35

    Programming a Printer Pipe?

    I need to write something that I don't know anything about doing. (If that makes any sense...)

    I need to write a software that will accept output from another program (Hercules Mainframe Emulator), look through it, search for a couple of lines, then save the output as various text files that start and end at certain points found in the search.

    Can someone point me in the right direction to start off?

  2. #2
    Member
    Join Date
    Mar 11
    Posts
    35

    Re: Programming a Printer Pipe?

    Bump

  3. #3
    Frenzied Member
    Join Date
    Sep 05
    Location
    Modesto, Ca.
    Posts
    1,592

    Re: Programming a Printer Pipe?

    A little more information would help. What type of output? A text file, XML file or something else. How will the data be formatted in the file, what will you be searching for and anything else that will make what you want to achieve clearer.

  4. #4
    Member
    Join Date
    Mar 11
    Posts
    35

    Re: Programming a Printer Pipe?

    Basically, Hercules will send the text/output directly to the program that I want to write via a pipe. There is no file until the software makes one. Since everything is sent to the program continuously, the program will have to look for a very specific phrase in a line so that it knows when to stop putting the text that it's recieving into one .txt file, and then begin another. From there, another software that I am designing will take that text file and process it based on specific settings (ie - send it directly to a printer, convert it to a PDF File, upload it to FTP, etc.)

    This description might sum it up a bit better:

    "Hercules provides another alternative in the form of print to pipe. The concept of pipes is the same as with most Linux/Unix systems. When the emulated printer has something to print, instead of writing to a file, it will redirect its output into the standard in (stdin) pipe of another program which is specified by the user. This allows virtually limitless possibilities for job output post-processing."

    That is the description provided on a site that provides another similar software, but I want to write my own software, because I need to customize things so that it works in the way that I need it to work. I looked at the code (distributed with the program download), but it's written in C, so I didn't really understand it all that well/know how to modify it to suit my needs.

    Does that clear it up a bit?

    BTW - The file that it's talking about in the description is a file that continuously posts the output without seperating it at all. It get's to be somewhat unmanageable, sometimes being up to megabytes in size, which makes it kind of hard for people that need specific output to download the file and search for what they need. The file itself can't be edited, otherwise the emulator will act up.

  5. #5
    Member
    Join Date
    Mar 11
    Posts
    35

    Re: Programming a Printer Pipe?

    Bump.

    Let me try rephrasing the question...

    How do I get the program to receive and handle the stdin functions?

  6. #6
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 10
    Location
    Denmark
    Posts
    521

    Re: Programming a Printer Pipe?

    According to wikipedia (link), the stdin and stdout streams can be accessed through System.Console.In and System.Console.Out respectively. The stdin stream is of class TextReader.
    So it's simply a matter of creating a background worker, that checks the input from this stream at regular intervals and raises an event (or completes) when a specific string has been found.

    Tom
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •