turbo c question (ibm pc clone)

Don_A_Corbitt at cup.portal.com Don_A_Corbitt at cup.portal.com
Tue Nov 15 01:57:48 AEST 1988


>I've been trying to use the 'system()' function call in my turbo c
>
>main()
>{
>	int		a;
>
>	a = system("dir a:");
>
>	if (!(a))
>		printf("\nSystem call successful");
>	else
>		printf("\nsystem call error");
>}
>(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).
>Jerry.  (jerry at starfish.convergent.COM)
Sounds like your problem is insufficient memory.  There is a bug in TC2.0
where the system() call doesn't return an error if insufficient memory to load 
command.com.  The work-around is to check errno after the call to system.  Errno
is set properly.  (Be sure to set errno=0; before calling system().)
	Don_A_Corbitt at cup.portal.com
	CrystalGraphics, Inc.
-----



More information about the Comp.lang.c mailing list