|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
程序功能主要是:读入已知文件,调用外部程序pfnt.exe进行相关的计算,然后把程序计算的结果以文档形式进行输出。但在运行到info.start()时,出现“系统找不到指定的文件”这个错误,请大虾指教!!!
4 Z F7 L4 s. [1 h# W R
+ H% V6 ~7 [8 L+ I: Busing System;
# E! B7 I" q6 L$ X: r) j0 Y; W2 Fusing System.Collections.Generic;
) X, j# E7 u. _ H, b4 B1 O8 Ousing System.Text;
1 u: ]& ^- J3 r( ]: {using System.Diagnostics;7 ~! z) Q, | D( D4 K/ C5 L# U
using System.IO;2 t2 Q! y4 n7 U0 A
& Y2 ? u2 Q( W" Y) Znamespace ConsoleApplication280 {4 n: b1 t2 h4 f
{2 C* G5 M1 [+ H9 I& y9 l& K
class Program7 K$ }* H% M' C9 j
{
) U/ s9 a8 b% h! X6 e5 E: ?% L# R' n static void Main(string[] args)1 A7 _. ]- Y8 n: c5 x3 ?
{
) v' g5 g7 [7 M4 y* c Process info = new Process();7 O) F. U) |$ q; J" V
info.StartInfo.FileName = "pfnt.exe";
/ e$ k+ g9 W) n+ U info.StartInfo.Arguments = @"E:\广东电网充裕度评估系统\BPA数据\2008年底大(正常潮流).dat";//原始数据文件路径
$ g/ Z0 b9 e' A+ x. b info.StartInfo.WorkingDirectory = @"C:\psap32\BIN";//pfnt。exe程序路径
0 `7 q: @) O9 E6 M; _ info.StartInfo.UseShellExecute = false;3 o5 @) F- s& x4 q z
info.StartInfo.RedirectStandardInput = true;
% K4 m( \& E0 U2 ?% `. v$ M( }1 A info.StartInfo.RedirectStandardOutput = true;! ~3 e! m$ x6 l
info.Start();
3 a. G6 _& h3 Q+ r0 |" k StreamReader sr = info.StandardOutput;& O" i; Q X6 V. T' C0 z0 ?% F
StreamWriter sw = new StreamWriter(@"E:\广东电网充裕度评估系统\童—潮流计算程序\powerflow.txt");//生成文档存放位置7 P) O7 k% d* o1 U
sw.Write(sr.ReadToEnd());4 T* @+ d" R+ j* x
sw.Close();/ o% y+ I) {- ]; t' M$ d
}
- t$ D, {% f9 O, i }9 h. ~ |' h1 l+ q" ]
} |
|