turbo c question (ibm pc clone)

Gerald Hawkins jerry at starfish.Convergent.COM
Sun Nov 13 02:32:00 AEST 1988


I've been trying to use the 'system()' function call in my turbo c
programs, just as I've always been able to do with Un*x and the cc
compiler.

After a great deal of pain and suffering, I've found that code such as
this:

#include <stdio.h>
#include <conio.h>
#include <process.h>

main()
{
	int		a;

	a = system("dir a:");

	if (!(a))
		printf("\nSystem call successful");
	else
		printf("\nsystem call error");
}

does not work within the turbo c integrated environment.  However, if I
compile the code, exit the integrated environment, and run the code, the
result is correct, ie, the directory is listed and the system call
successful is displayed.

(When running it within tc2.0, the system() call never really seems to
happen, but a does get set to zero, indicating a successful call!  The
System call successful message prints).

I havn't contacted Borland yet.  Does anybody out there know how to make
this work from within the tc environment?


Rainy Days and
Automatic Weapons Fire
Alway Get Me Down.

These opinions are mine.
Jerry.  (jerry at starfish.convergent.COM)
-----



More information about the Comp.lang.c mailing list