开发者

Adding program arguments to C

开发者 https://www.devze.com 2023-01-14 04:15 出处:网络
How can I load the batch file console to my C console? I know in batch The command is Showme.bat /B and it\'ll load the console into whatever console you called that file from.

How can I load the batch file console to my C console?

I know in batch The command is Showme.bat /B and it'll load the console into whatever console you called that file from.

What would that be in C?

ShellExecute(NULL,"open","Showme.bat",NULL,NULL,SW_SHOW); 

Also, doing that... How could I also add additional arguments s开发者_Python百科uch as

>>LogTheConsoleTo-a-File.log

Is that possible?


Use the POSIX function "popen". With MSVC/MinGW you can use "_popen" instead. This give you the needed control.


I figured it out but I still cannot keep writing to the same file.

Here's what I did: ShellExecute(NULL,"open","Showme.bat",">>consoleLog.log",NULL,SW_SHOW);

0

精彩评论

暂无评论...
验证码 换一张
取 消