Passing in Argvs in windows
-
I know this is a really stupid question, but I'm use to programming on Unix systems. I wrote a program using MS Visual C++, and I want to pass in a value into the argsv. so I can run it at the command prompt something like: "whatever.exe filename.txt" of course this doesn't work. Any ideas? :confused: ICXC NIKA
-
I know this is a really stupid question, but I'm use to programming on Unix systems. I wrote a program using MS Visual C++, and I want to pass in a value into the argsv. so I can run it at the command prompt something like: "whatever.exe filename.txt" of course this doesn't work. Any ideas? :confused: ICXC NIKA
Why doesn't it work, I have done that lots of times... Starting a program with "whatever.exe filename.txt" from the command promt I mean, and it works just fine. What exactly are you trying to do that don't work? - Anders Money talks, but all mine ever says is "Goodbye!"
-
Why doesn't it work, I have done that lots of times... Starting a program with "whatever.exe filename.txt" from the command promt I mean, and it works just fine. What exactly are you trying to do that don't work? - Anders Money talks, but all mine ever says is "Goodbye!"
-
It works when I use the ms-dos command prompt. when I just go to start and run, then browse, then try to do it, it's a no go. :wtf: ICXC NIKA
You have to write "someprogram.exe" somefile.txt instead of "someprogram.exe somefile.txt" Then it works :-) - Anders Money talks, but all mine ever says is "Goodbye!"
-
I know this is a really stupid question, but I'm use to programming on Unix systems. I wrote a program using MS Visual C++, and I want to pass in a value into the argsv. so I can run it at the command prompt something like: "whatever.exe filename.txt" of course this doesn't work. Any ideas? :confused: ICXC NIKA
I'm not sure whether this is what you're after, but in a Windows-based app you can use the variables
__argc
and__argv
just as you did with the usualmain
parms in an Unix console program. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
I know this is a really stupid question, but I'm use to programming on Unix systems. I wrote a program using MS Visual C++, and I want to pass in a value into the argsv. so I can run it at the command prompt something like: "whatever.exe filename.txt" of course this doesn't work. Any ideas? :confused: ICXC NIKA
WinMain(), as you've seen, doesn't have the argc/argv params. You can access them via the lpCmdLine parameter to WinMain(). Alternatively, there are __argc and __argv variables that the CRT sets up for you that work like argc/argv. --Mike-- Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm