Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Expect Library

Expect Library

Scheduled Pinned Locked Moved The Lounge
comtoolstutorialquestion
18 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Ryan Binns

    WTF? :wtf:

    Ryan

    "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

    T Offline
    T Offline
    trelliot
    wrote on last edited by
    #8

    Any C (C++) programme accepts command line arguements - that's the 'argv, argc' in main() - what you do with them is up to you...

    R 1 Reply Last reply
    0
    • T trelliot

      Any C (C++) programme accepts command line arguements - that's the 'argv, argc' in main() - what you do with them is up to you...

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #9

      I know that, but WTF did that have to do with his question?

      Ryan

      "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

      T 1 Reply Last reply
      0
      • R Ryan Binns

        I know that, but WTF did that have to do with his question?

        Ryan

        "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

        T Offline
        T Offline
        trelliot
        wrote on last edited by
        #10

        Easy - either Archer rewrites the command interpreter, adds a commandline intercept (alias) or renames the 'A' programme so 'he or she' can intercept the command and supply appropriate args

        1 Reply Last reply
        0
        • T trelliot

          [, char *envp[ ] ] ] ); The types for argc and argv are defined by the language. The names argc, argv, and envp are traditional, but are not required by the compiler. See Argument Definitions for more information and for an example. Alternatively, the main and wmain functions can be declared as returning void (no return value). If you declare main or wmain as returning void, you cannot return an exit code to the parent process or operating system using a return statement; to return an exit code when main or wmain is declared as void, you must use the exit function.

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #11

          trelliot wrote: A special function called main is the starting point of execution for all C and C++ programs. The main function is not predefined by the compiler; rather, it must be supplied in the program text. The declaration syntax for main is: [...snipped...][...snipped...][...snipped...] as void, you must use the exit function. :wtf: Why explain this to the guy who wrote Visual C++ Bible?

          C 1 Reply Last reply
          0
          • T trelliot

            [, char *envp[ ] ] ] ); The types for argc and argv are defined by the language. The names argc, argv, and envp are traditional, but are not required by the compiler. See Argument Definitions for more information and for an example. Alternatively, the main and wmain functions can be declared as returning void (no return value). If you declare main or wmain as returning void, you cannot return an exit code to the parent process or operating system using a return statement; to return an exit code when main or wmain is declared as void, you must use the exit function.

            F Offline
            F Offline
            fakefur
            wrote on last edited by
            #12

            :wtf:

            1 Reply Last reply
            0
            • K krisko

              Oops there was a formatting error. Here is the link once again http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating\_a\_child\_process\_with\_redirected\_input\_and\_output.asp

              J Offline
              J Offline
              Jorgen Sigvardsson
              wrote on last edited by
              #13

              click click[^] -- An eye for an eye will only make the world blind.

              1 Reply Last reply
              0
              • N Nish Nishant

                trelliot wrote: A special function called main is the starting point of execution for all C and C++ programs. The main function is not predefined by the compiler; rather, it must be supplied in the program text. The declaration syntax for main is: [...snipped...][...snipped...][...snipped...] as void, you must use the exit function. :wtf: Why explain this to the guy who wrote Visual C++ Bible?

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #14

                Nishant Sivakumar wrote: Why explain this to the guy who wrote Visual C++ Bible? I thought it was rather funny.


                My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

                V 1 Reply Last reply
                0
                • C Colin Angus Mackay

                  Nishant Sivakumar wrote: Why explain this to the guy who wrote Visual C++ Bible? I thought it was rather funny.


                  My: Blog | Photos WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

                  V Offline
                  V Offline
                  Vikram A Punathambekar
                  wrote on last edited by
                  #15

                  Colin Angus Mackay wrote: I thought it was rather funny. Me too. :-D I was actually visualizing Tom's face as he read the post (or the email). Vikram.


                  http://www.geocities.com/vpunathambekar "It's like hitting water with your fist. There's all sorts of motion and noise at impact, and no impression left whatsoever shortly thereafter." — gantww.

                  T 1 Reply Last reply
                  0
                  • V Vikram A Punathambekar

                    Colin Angus Mackay wrote: I thought it was rather funny. Me too. :-D I was actually visualizing Tom's face as he read the post (or the email). Vikram.


                    http://www.geocities.com/vpunathambekar "It's like hitting water with your fist. There's all sorts of motion and noise at impact, and no impression left whatsoever shortly thereafter." — gantww.

                    T Offline
                    T Offline
                    Tom Archer
                    wrote on last edited by
                    #16

                    :-D I was just like "Oooooo kay" I just figured he/she didn't understand the question or was joking around with me. Cheers, Tom Archer - Archer Consulting Group
                    "So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe

                    1 Reply Last reply
                    0
                    • T trelliot

                      [, char *envp[ ] ] ] ); The types for argc and argv are defined by the language. The names argc, argv, and envp are traditional, but are not required by the compiler. See Argument Definitions for more information and for an example. Alternatively, the main and wmain functions can be declared as returning void (no return value). If you declare main or wmain as returning void, you cannot return an exit code to the parent process or operating system using a return statement; to return an exit code when main or wmain is declared as void, you must use the exit function.

                      T Offline
                      T Offline
                      Tom Archer
                      wrote on last edited by
                      #17

                      I appreciate the reply, but that problem isn't one of passing params to a command processor. The problem is interacting with the processor - especially in cases where a command-line app hasn't finished processing, but has requested more info. Cheers, Tom Archer - Archer Consulting Group
                      "So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe

                      1 Reply Last reply
                      0
                      • K krisko

                        If it is a Unix client (assuming C/C++/Perl/Shell Script), it should be easy to use the Expect API within the client program itself to invoke a telnet session to a Windows Server. However this assumes that the program(yours) running on the Windows server should be a command line program and can be executed via a telnet session on the Windows Server, then Expect would be a good bet. However if it has to go through the Windows Service then I think you will have to spawn a child process and control its Read/Write handles from your service and finally return the output to the Unix client. I am assuming the communication b/w your Windows Service and the Unix Client is Sockets. A quick search yielded this and the idea I used is the pretty much the same for my project

                        T Offline
                        T Offline
                        Tom Archer
                        wrote on last edited by
                        #18

                        Sorry. Got sidetracked on other tasks with re: to the same app. The Windows Service must be in control of the entire thing. IOW, the Unix client will send commands to the Service to run. The Service will run the command and send results back to the client. A command might return to the prompt or it might not (as in the case of a command line app such as ftp or telnet) and I'll need to interactively send whatever the app displays back to teh client. Does this sound like Expect for Windows would work for me? Cheers, Tom Archer - Archer Consulting Group
                        "So look up ahead at times to come, despair is not for us. We have a world and more to see, while this remains behind." - James N. Rowe

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups