this is a mirrored site c-faq. thought might need offline

源代码在线查看: system.html

软件大小: 1938 K
上传用户: koalalee
关键词: mirrored offline thought c-faq
下载地址: 免注册下载 普通下载 VIP

相关代码

																																																																												Question 19.27																																				 																								comp.lang.c FAQ list				·				Question 19.27												Q:				How can I invoke				another program				(a standalone executable,				or an operating system command)				from within a C program?												A:				Use				the library function				system,				which does exactly that.				Some systems also provide a family of spawn				routines which accomplish				approximately the same thing.				system is more ``portable''				in that it is required under the ANSI C Standard,				although the interpretation of the command				string--its				syntax and the set of commands				accepted--will				obviously vary tremendously.				The				system				function								``calls''				a command in the manner of 				a subroutine,				and control				eventually				returns to the calling program.				If you want to overlay the calling program with another program				(that is,				a ``chain'' operation)				you'll need a				system-specific routine,				such as the exec family on Unix.				Note				that system's return value				is				at best				the command's exit status				(although even that is not guaranteed),				and usually has nothing to do with the output of the command.				See also				questions				19.28				and				19.30.																																				References:								K&R1 Sec. 7.9 p. 157								K&R2 Sec. 7.8.4 p. 167, Sec. B6 p. 253								ISO Sec. 7.10.4.5								H&S Sec. 19.2 p. 407								PCS Sec. 11 p. 179																												 																about this FAQ list				 				about eskimo				 				search				 				feedback				 				copyright								Hosted by																											

相关资源