现在的位置: 首页 > 综合 > 正文

C语言调用exe并将结果输出到文件

2013年10月05日 ⁄ 综合 ⁄ 共 235字 ⁄ 字号 评论关闭

  C语言调用控制台程序(exe)文件使用system函数 ,函数原型为

    int system( const char *command );

具体的用法请查MSDN。

  输入使用输入输出重定向。下面是用VC6.0写的一个简单的例子。

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

void main(void)
{
 system("Schedul.exe  > 1.txt");
 system("type 1.txt");
}

 

抱歉!评论已关闭.