Thread: command line arguments

  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    dehradun
    Posts
    5

    Unhappy command line arguments

    please can anyone tell me whether i can use command line arguments in c on windows xp
    if so how

  2. #2
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    you just posted a thread on this.... don't post the same thread twice!
    the answer is YES.

    how:

    start>run>"cmd"
    then...

    cd c:\path\to\file\
    then...

    bla.exe ARG1 ARG2
    --------------------------

    bla.exe would be from your bla.c which would have

    int main(argc, *argv[])

    argc <-- number of arguments
    argv <-- the arguments


    process accordingly...

    http://publications.gbdirect.co.uk/c...s_to_main.html
    http://www.d.umn.edu/~gshute/C/argv.html
    Last edited by simpleid; 08-15-2007 at 08:05 AM.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. GradeInfo
    By kirksson in forum C Programming
    Replies: 23
    Last Post: 07-16-2008, 03:27 PM
  3. command line arguments
    By vurentjie in forum C Programming
    Replies: 3
    Last Post: 06-22-2008, 06:46 AM
  4. NULL arguments in a shell program
    By gregulator in forum C Programming
    Replies: 4
    Last Post: 04-15-2004, 10:48 AM
  5. registry, services & command line arguments.. ?
    By BrianK in forum Windows Programming
    Replies: 3
    Last Post: 03-04-2003, 02:11 PM