Find the answer to your Linux question:
Results 1 to 6 of 6
googled it and infoed it, didn't find anything on how to use them and get the values in the program...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    12

    C: how to pass arguments using -l and s <num>

    googled it and infoed it, didn't find anything on how to use them and get the values in the program

  2. #2
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Reading arguments is done by looping through argv, or by using getopts()

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    12
    ok but what's the use of -l and -s here? why don't i just pass them as normal arguments if so?

  4. #4
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    I rly don't understand your question. Your argument list is referenced by a pointer to the first element of an array called argv. Are you talking about a specific program here?

  5. #5
    Just Joined!
    Join Date
    Feb 2007
    Posts
    12
    let's say i wana run this program ./simple-batch.e -l6 or ./simple-batch.e -s5

    what do -l and -s do?

  6. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Whatever you want them to? Options aren't universal, the programmer of the application decides what options do what.

Posting Permissions

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