|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
* in command line causes havoc
when a * is inputted as one of the arguments in a command line call odd things happen. this is from a command line version of a polish calculator (one of the k&r exercises) :
./a.out 1 2 - 4 5 + - results in: -10 ./a.out 1 2 - 4 5 + * results in: error: unknown command a error: unknown command o error: unknown command t error: unknown command c error: unknown command l 9 one previous not-working version of this code, outputted (that means was part of argv) everyone of the file names in my current directory when * was one of the command line arguments. why should the * play such havoc? i get the feeling it must be something to do with the environement? that the * as one of the command line arguments is designed to do something i don't know about maybe? i know it's a wildcard and therefore symbolises 'everything' on it's own but why should this effect anything in my particular situation? Last edited by balance : March 31st, 2003 at 08:58 AM. |
|
#2
|
||||
|
||||
|
It looks like the * is indeed being expanded to a file-list. It will need to be quoted to tell the shell to leave it alone.
Try: ./a.out 1 2 - 4 5 + \* |
|
#3
|
|||
|
|||
|
yup, you're right. that got it. thanks.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > * in command line causes havoc |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|