passing in * from command line

This is a discussion on passing in * from command line within the C Programming forums, part of the General Programming Boards category; I need to pass in a * from the command line in a windows program I'm writing. However the * ...

  1. #1
    Registered User eth0's Avatar
    Join Date
    Dec 2003
    Posts
    164

    passing in * from command line

    I need to pass in a * from the command line in a windows program I'm writing.

    However the * is automatically listing all the files in the directory.

    I know I can pass in "*", but I don't want to have to pass the "s

    I know it's possible because MS' arp utility can pass arguments such as 'arp -d *'

    How do I get around this?
    Last edited by eth0; 09-13-2005 at 03:55 AM.
    Open source isn't a matter of life or death......
    .......its much more important than that!!


    SuSE Linux - GCC 3.4.2
    XP Pro - Visual Studio 2005 TS, MinGW 3.4.2

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    Which compiler are you using?

    Some compilers allow you to choose which type of command line expansion you want. You want one which doesn't expand at all - that is, what you type is what you get.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    don't know if it will work, but try escaping the *
    Code:
    arp -d \*

  4. #4
    Registered User eth0's Avatar
    Join Date
    Dec 2003
    Posts
    164
    Quote Originally Posted by Salem
    Which compiler are you using?
    I'm using mingw gcc 3.4.2

    Do you know if this feature is available for this?

    I'm reading through the gcc docs now, but haven't stumbled across it yet.
    Open source isn't a matter of life or death......
    .......its much more important than that!!


    SuSE Linux - GCC 3.4.2
    XP Pro - Visual Studio 2005 TS, MinGW 3.4.2

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,506
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User eth0's Avatar
    Join Date
    Dec 2003
    Posts
    164
    Great!
    Thank you.
    Open source isn't a matter of life or death......
    .......its much more important than that!!


    SuSE Linux - GCC 3.4.2
    XP Pro - Visual Studio 2005 TS, MinGW 3.4.2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing struct vs. reference
    By reakinator in forum C Programming
    Replies: 4
    Last Post: 06-14-2008, 10:11 PM
  2. Newb Question on Passing Objects as Parameters
    By Mariano L Gappa in forum C++ Programming
    Replies: 12
    Last Post: 11-29-2006, 12:08 PM
  3. Passing by reference not always the best
    By franziss in forum C++ Programming
    Replies: 3
    Last Post: 10-26-2005, 07:08 PM
  4. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  5. passing by address vs passing by reference
    By lambs4 in forum C++ Programming
    Replies: 16
    Last Post: 01-09-2003, 12:25 AM

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