Don't be ridiculous.
Code:C:\Users\tabstop>copy con wild.c #include <stdio.h> int main(int argc, char *argv[]) { printf("argc = %d\n", argc); int i; for (i = 0; i < argc; i++) { printf("argv[%d]=%s\n", i, argv[i]); } return 0; } ^Z 1 file(s) copied. C:\Users\tabstop>gcc -o wild.exe wild.c C:\Users\tabstop>wild *i argc = 4 argv[0]=wild argv[1]=gsview32.ini argv[2]=ntuser.ini argv[3]=psv.ini
Ah, running cmd /? and then pressing enter a couple of times lead me to a text telling me some characters needed to be within "" when printed to console. & was among them, * was not, but ' was so I assume * is mistaken for '. I guess that explains the most of it. The input is taken as * but when printed to console it is read as a command by the console. Thank you all!
Sorry, Im an idiot. Checked again since you posted code here to show you my code, and I did get several files listed.tabstop: I am 100% sure. I tested this before posting here. I had a program printing argv[n] where n went beyond the list of suitable files. When it went beyond, it just printed zeroes in those spots...
Last edited by Hear.Me.ROAR; 07-11-2011 at 05:57 PM.
The characters as given are for quoting in filenames rather than starting a new argument. (I think I said quoting earlier, so that's my fault.) EDIT: According to http://www.microsoft.com/resources/d....mspx?mfr=true, the escape character is ^, which I had forgotten. EDIT EDIT: ^ may be the escape character, but it doesn't work on * or ?.
Did it print argv, or did it print atoi(argv[n])? Not quite the same thing....tabstop: I am 100% sure. I tested this before posting here. I had a program printing argv[n] where n went beyond the list of suitable files. When it went beyond, it just printed zeroes in those spots...
Last edited by tabstop; 07-11-2011 at 06:28 PM.
Yeah, the later, atoi, that is why I got the wrong output according to what should be shown (a list of files). Read the other posts, I corrected them and gave you the cred for that path of the discussion. Once again, completely my fault :/
Not a problem. (But if you wonder why we often ask for actual code and actual input and actual output -- this is why. Not that you're trying to deceive us, but if we're getting almost-but-not-quite the actual information, that leads to almost-but-not-quite help on the other end.)
tabstop: You're the man!