Re: command_line() with *
- Posted by georgeorr Apr 16, 2009
- 870 views
I have had no problem at all with using command_line() with any arguments except *. I have built a fairly complete reverse polish calculator, and just put in an opening routine to pull arguments directly from the command line. Everything had tested OK, but I guess I didn't use * until later in testing. Then is when I started seeing "weird" arguments that turned out to be the file/directory names in the current directory, and then asked to see if anyone else knew a way around this.
Everything works fine if I quote the arguments or escape the *. The program parses the input string and does its thing with no problems. But as Jeremy points out this isn't very friendly and makes inputs at the command line different from within the program. I obviously just didn't realize that command_line() was interacting with the operating system as much as it does. I guess if I had looked at the code I would have known...
The little calculator I am playing with is really just a way to try out the stack.e and map.e routines in EU4.0. They really make this type of calculator almost trivial. I have been very impressed with the capabilities I am finding throughout EU4.0. But once I have something simple that works well, I am always tempted to add just a few bells and whistles (like pulling in the initial string to be executed from the command line) and start getting myself in trouble! I guess it's fun, though, or I wouldn't be spending my time away from work working so hard...
Thanks again for the responses. This was just a behavior I wasn't expecting, and the experience of others is invaluable in making sure I am not just being stupid again!