|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
程序功能主要是:读入已知文件,调用外部程序pfnt.exe进行相关的计算,然后把程序计算的结果以文档形式进行输出。但在运行到info.start()时,出现“系统找不到指定的文件”这个错误,请大虾指教!!!8 \6 ~5 ]! m/ q0 | J
7 u) ^0 o/ p' e. tusing System;0 l% _3 |+ I9 t' m
using System.Collections.Generic;! w* Q3 b% `7 y- R6 f9 Y1 m$ a0 n
using System.Text;3 R) ]. E) R k0 T# r
using System.Diagnostics;2 d4 z& _, @4 T3 a, s& W0 ~/ S! W
using System.IO;0 R; A' D: ]# q; N" P, m' d
" a6 ^9 |; r. t9 O+ m- E, T+ t* O: Nnamespace ConsoleApplication28
! M P* ^5 E. u, i{& j3 _2 g* M* p8 s# Y9 s' n9 a; u, z
class Program( C- l7 ~: W/ T9 y* s& K
{$ R, ^% ], ]5 g
static void Main(string[] args)+ ?0 `, p+ s, O+ X9 K7 U2 f) v
{
, k! a5 g" t+ {* U2 { Process info = new Process();
0 F7 f4 m; C0 a4 Q$ B. r/ \/ } info.StartInfo.FileName = "pfnt.exe";
; t, Q" o4 u4 K; I# P3 s3 R% c info.StartInfo.Arguments = @"E:\广东电网充裕度评估系统\BPA数据\2008年底大(正常潮流).dat";//原始数据文件路径: Z% T( E; j: K4 x
info.StartInfo.WorkingDirectory = @"C:\psap32\BIN";//pfnt。exe程序路径4 h6 n3 E1 p( R0 w* x) T
info.StartInfo.UseShellExecute = false;
7 f8 _/ L- i2 B# [) y1 j! m8 Z info.StartInfo.RedirectStandardInput = true;
& N4 q3 @1 ~; o G/ D& \" l0 Z info.StartInfo.RedirectStandardOutput = true;7 p% F6 U9 u; \) v8 i# L
info.Start();
6 k9 q* q/ N% N4 C% \5 _ StreamReader sr = info.StandardOutput;. h6 [3 K& N, u/ |! V
StreamWriter sw = new StreamWriter(@"E:\广东电网充裕度评估系统\童—潮流计算程序\powerflow.txt");//生成文档存放位置
2 H/ b+ E2 M: v sw.Write(sr.ReadToEnd());' w, p( s. j/ {. [" B# ~
sw.Close(); V2 U3 A! k3 @+ ]. I1 J% C# w
}
+ P# A1 u7 n) u/ {( k }5 C( i, p( L! n; M& C! C
} |