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. General Programming
  3. C / C++ / MFC
  4. parsing result from command line arguments in c++

parsing result from command line arguments in c++

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsontutorialquestion
8 Posts 4 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.
  • A Offline
    A Offline
    an89
    wrote on last edited by
    #1

    my requirement is that i have to set static ip address in command line and the netsh command i have to call from my c++ program.van any body suggest how to accomplish this?

    _ J D 3 Replies Last reply
    0
    • A an89

      my requirement is that i have to set static ip address in command line and the netsh command i have to call from my c++ program.van any body suggest how to accomplish this?

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      an89 wrote:

      parsing result from command line arguments in c++

      See Here[^].

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      A 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        an89 wrote:

        parsing result from command line arguments in c++

        See Here[^].

        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        A Offline
        A Offline
        an89
        wrote on last edited by
        #3

        its not goin to help.if anybody can provide some sample code,then that would be helpfull.My requirement is that what ever i get at commandline,i should be able to get it back in my code

        _ 1 Reply Last reply
        0
        • A an89

          its not goin to help.if anybody can provide some sample code,then that would be helpfull.My requirement is that what ever i get at commandline,i should be able to get it back in my code

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          an89 wrote:

          its not goin to help

          and why isn't it going to help? Any wise guesses :rolleyes: You asked about reading the command line arguments and parsing them. The logic does the same :doh:

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          A 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            an89 wrote:

            its not goin to help

            and why isn't it going to help? Any wise guesses :rolleyes: You asked about reading the command line arguments and parsing them. The logic does the same :doh:

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            A Offline
            A Offline
            an89
            wrote on last edited by
            #5

            see,in the tutorial that u mentioned we have to give arguments at commandline,right?and in the program we are extracting those arguments. But in my application,through my code i'll give a command,and i need the output of the command when the command executes successfully.I hope I made myself clearer this time.

            _ 1 Reply Last reply
            0
            • A an89

              my requirement is that i have to set static ip address in command line and the netsh command i have to call from my c++ program.van any body suggest how to accomplish this?

              J Offline
              J Offline
              Jijo Raj
              wrote on last edited by
              #6
              1. Parse the commandline and get ip address as suggested by _AnShUmAn_. 2) For setting static ip by using netsh command, Please refer this link - http://support.microsoft.com/kb/257748[^] 3) For executing netsh command from your C++ code, use ShellExecute() api. Check its documentation here - http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx[^] Regards, Jijo.

              _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

              1 Reply Last reply
              0
              • A an89

                see,in the tutorial that u mentioned we have to give arguments at commandline,right?and in the program we are extracting those arguments. But in my application,through my code i'll give a command,and i need the output of the command when the command executes successfully.I hope I made myself clearer this time.

                _ Offline
                _ Offline
                _AnsHUMAN_
                wrote on last edited by
                #7

                humf. :^) You can use the argument to pass as a parameter to ShellExecute or CreateProcess. how do you give the command and to whom...

                an89 wrote:

                I hope I made myself clearer this time.

                Not for me, it's still a blurr picture

                Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                1 Reply Last reply
                0
                • A an89

                  my requirement is that i have to set static ip address in command line and the netsh command i have to call from my c++ program.van any body suggest how to accomplish this?

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  an89 wrote:

                  suggest how to accomplish this?

                  By searching for argc and argv.

                  "Love people and use things, not love things and use people." - Unknown

                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                  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