![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-31 14:52 |
47,815 topics / 349,930 posts / today 0 new / 48,290 members |
| DOS开发编程 & 发展交流 (开发室) » How to call DOS system commands in C without showing the command line? |
| Printable Version 2,212 / 12 |
| Floor1 utada | Posted 2003-08-05 00:00 |
| 初级用户 Posts 5 Credits 121 | |
|
In C, when using execl to call another application under DOS, the command line gets displayed. How can I make that information not show up?
Just like when using the sys function to call the copy command, the screen shows *** file copied. How can I keep that sentence from being displayed |
|
| Floor2 Wengier | Posted 2003-08-06 00:00 |
| 系统支持 Posts 10,521 Credits 27,736 | |
|
Try adding ">nul" at the end. . .
|
|
| Floor3 utada | Posted 2003-08-07 00:00 |
| 初级用户 Posts 5 Credits 121 | |
|
I tried it. It doesn't work. Thank you anyway
|
|
| Floor4 yanyanming | Posted 2003-08-09 00:00 |
| 初级用户 Posts 1 Credits 106 | |
|
Use echo
|
|
| Floor5 lemonhall | Posted 2003-08-10 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
Under DOS 7.1, using ECHO can remove the COPY XXX shown when doing system("copy xxx"
.Using system("copy xxx >nul" ; should remove that failed..... line.I haven't tried exec calls. There's another possibility: you're using an EXE file compiled with DJGPP. Its redirection is a bit different from ordinary DOS programs, so try using system("XXX XXX >>NUL" for redirection. If that still doesn't work,come back and ask again. If it really won't work, send me what you want to call, and after I test it I'll send you the source code. |
|
| Floor6 lemonhall | Posted 2003-08-10 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
Oh right, I forgot to ask. What DOS version are you using? What compiler system?
|
|
| Floor7 utada | Posted 2003-08-11 00:00 |
| 初级用户 Posts 5 Credits 121 | |
|
I'm using MS-DOS 6.22. Do I have to use DOS 7.1?
What I'm calling is an application made by someone else, used for FTP uploads under DOS. |
|
| Floor8 iceboy | Posted 2003-08-12 00:00 |
| 银牌会员 Posts 512 Credits 1,681 | |
|
">" and ">>" are redirection symbols. They can only redirect program output, and can't do anything about system prompts like "Bad command or file name".
|
|
| Floor9 lemonhall | Posted 2003-08-17 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
With ECHO OFF as a prerequisite, add the redirection. Everything will become absolutely silent. Hehe. . . .
|
|
| Floor10 LanE | Posted 2003-08-17 00:00 |
| 银牌会员 Posts 648 Credits 1,835 | |
The following is quoted from iceboy's post at 2003-8-12 14:55:36: Also, program error messages can't be redirected either, for example: C:\>copy a.txt d:\ >nul File not found - a.txt I copied this from a DOS window |
|
| Floor11 lemonhall | Posted 2003-08-18 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
Yeah, that's right. But under system and EXEC() calls,
it really is completely silent. We're not discussing redirection itself, we're discussing "the use of redirection in programming". The discussion should address the OP's question!! |
|
| Floor12 lemonhall | Posted 2003-08-18 00:00 |
| 高级用户 Posts 183 Credits 639 | |
|
Sigh, DOS 6.22 or DOS 7, that doesn't really matter. . . . . . . . . .
Just send the program directly to me, and I'll try it with all the most popular compiler systems. Wouldn't that solve it?? I guess you're using TURBO C, right? Or BC? If you're using BC, you can also redirect ERROR output and do it with C++ streams. There are plenty of ways. |
|
| Floor13 LanE | Posted 2003-08-18 00:00 |
| 银牌会员 Posts 648 Credits 1,835 | |
The following is quoted from lemonhall's post at 2003-8-18 11:34:57: Hehe, sorry about that I forgot this was the programming section ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |