well i tried to execute the following code..

void main()

but it did not execute the system command... what went wrong??

plz mail me at [email]prajwaludupardx_369@yahoo.co.in[/email]

i have also trouble in running the dos commands in turbo c++ . when i compile it everything goes wright . but at the time of execution it shows blanks screen not any dos commands. Atually Borland turbo c++ do not support dos commnads beside you can use "dev c++" to execute dos commands.

IIRC, it worked just fine. You aren't seeing output because of the way Turbo C/C++ initializes the console output.

The problem is that you are doing something wrong. Are you trying to get a directory listing? Or just show it to the user?

system() command used here should generate desired output for dir, And i agree with Duoas as per output on console is concerned.

Though to validate system call functionality, one can try to redirect the output to a file.

void main() 
system("dir >>test_dir.lst");

check 'test_dir.lst' for the desired output.

dos command using the system() function not works while run the code. make exe and run that one by doule click. it will works !!

This article has been dead for over six months. Start a new discussion instead.