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. help with command line arguments...

help with command line arguments...

Scheduled Pinned Locked Moved C / C++ / MFC
linuxhelpquestion
4 Posts 2 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.
  • S Offline
    S Offline
    Snyp
    wrote on last edited by
    #1

    Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.

    I 2 Replies Last reply
    0
    • S Snyp

      Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.

      I Offline
      I Offline
      ian mariano
      wrote on last edited by
      #2
      /*   C madness   */
      #include   <stdio.h>
       
      int   main(int argc, char** argv)
      {
          for (int i = 0; i < argc; i++)
             printf("Arg %d = %s\r\n", i, argv[i]);
       
          return 0;
      }
      

      This small C program will dump the args. The process of receiving args for console apps hasn't changed a bit ;)

      Ian Mariano - http://www.ian-space.com/
      "We are all wave equations in the information matrix of the universe" - me

      1 Reply Last reply
      0
      • S Snyp

        Im going to make a console project... don't ask... and I need to add command line arguments, im using windows xp, and somehow when I add the command line arguments to the end of the filename e.g. somefile.exe /something it says "/" and a bunch of other characters aren't alowed to be used... has windows xp completely taken off command line arguments??:confused: sry its just that the last time I had command line arguments to one of my programs was when windows '98 came out. Actual Linux Penguins were harmed in the creation of this message.

        I Offline
        I Offline
        ian mariano
        wrote on last edited by
        #3

        Oh yeah. If you're wanting a string with spaces, enclose them in quotes to get a single argument, e.g., long filenames with spaces: someprog.exe /v /n:5 "c:\my program data\my file data.txt" The above yields 3 arguments passed to someprog.exe, plus somearg.exe itself. arg0 = someprog.exe arg1 = /v arg2 = /n:5 arg3 = c:\my program data\my file data.txt

        Ian Mariano - http://www.ian-space.com/
        "We are all wave equations in the information matrix of the universe" - me

        S 1 Reply Last reply
        0
        • I ian mariano

          Oh yeah. If you're wanting a string with spaces, enclose them in quotes to get a single argument, e.g., long filenames with spaces: someprog.exe /v /n:5 "c:\my program data\my file data.txt" The above yields 3 arguments passed to someprog.exe, plus somearg.exe itself. arg0 = someprog.exe arg1 = /v arg2 = /n:5 arg3 = c:\my program data\my file data.txt

          Ian Mariano - http://www.ian-space.com/
          "We are all wave equations in the information matrix of the universe" - me

          S Offline
          S Offline
          Snyp
          wrote on last edited by
          #4

          are you doing this on windows xp.. because for me it says / and some other characters are illegal to use Actual Linux Penguins were harmed in the creation of this message.

          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