Hi. Does anyone know how to execute system() statement in a DOS Emulator like DOS BOX. For example for the following code :

#include <stdlib.h>
#include <stdio.h>

int main(void)
{
   printf("About to spawn command.com and run a DOS command\n");
   system("dir");
   return 0;
}

It only displays "About to spawn command.com and run a DOS command" but does not show the directory.

When I tried to check errno it displayed 8 i.e Access denied. Help

Note: Program compiled and run in Turbo c++ through DOSBox

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.