parameters algorythm

This is a discussion on parameters algorythm within the C Programming forums, part of the General Programming Boards category; I was wondering if anyone knew of an algorythm that works for command line arguments. Like in Linux you could ...

  1. #1
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926

    parameters algorythm

    I was wondering if anyone knew of an algorythm that works for command line arguments. Like in Linux you could have a program that is like
    Code:
    ls -l -s -R
    or
    Code:
    ls -lsR
    They can be combined or in any order. I always wondeered what the algorythm was I can't seem to write a small one myselft. When I right it, the program becomes huge just for the algorythm. This isn't homework just thought about righting a linux program. Plus I am not even out of High school so they don't even teach it. Thanx in advance

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    getopt() is your friend, if you have it. Look it up in man. Alternatively, there's source for it lying around on the web.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 07-21-2008, 06:04 AM
  2. function with variable number of parameters
    By mikahell in forum C++ Programming
    Replies: 3
    Last Post: 07-23-2006, 03:35 PM
  3. Additional parameters for operator delete
    By darksaidin in forum C++ Programming
    Replies: 0
    Last Post: 09-21-2003, 11:46 AM
  4. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 02:13 AM
  5. command-line parameters.
    By Tombear in forum C Programming
    Replies: 2
    Last Post: 10-28-2001, 07:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21