|
|
|
马上加入,结交更多好友,共享更多资料,让你轻松玩转电力研学社区!
您需要 登录 才可以下载或查看,没有账号?立即加入
×
程序功能主要是:读入已知文件,调用外部程序pfnt.exe进行相关的计算,然后把程序计算的结果以文档形式进行输出。但在运行到info.start()时,出现“系统找不到指定的文件”这个错误,请大虾指教!!!
( q8 o: v9 A1 D1 C0 I+ @
1 W$ t- c6 s/ c4 T6 O+ s3 t3 L0 Uusing System;. _' R0 D6 b+ [; t) z3 ^
using System.Collections.Generic;
7 M. Y" _8 ]9 q% z$ Ousing System.Text;
$ T* X+ B |1 Tusing System.Diagnostics;
( M3 E4 e, T4 uusing System.IO;
- [ S! G4 @- q' B4 v# R
3 u/ y6 c" y& h- o3 Pnamespace ConsoleApplication285 u8 \1 W; i# M1 M* E
{
: k+ ] j( K1 u, d: _ class Program
4 m0 ~" N6 N% d {" C1 }6 _- N5 X9 M: J7 {7 `8 ]) K
static void Main(string[] args)6 f4 f$ Y# q5 r4 p( |& Q
{# Y2 \3 k" u0 V$ o) W6 K5 `
Process info = new Process();
; \; `& z& `8 G+ ^3 q info.StartInfo.FileName = "pfnt.exe";
A8 C+ d) ^/ h+ D# h, P1 B info.StartInfo.Arguments = @"E:\广东电网充裕度评估系统\BPA数据\2008年底大(正常潮流).dat";//原始数据文件路径# G2 Z7 O o. ?
info.StartInfo.WorkingDirectory = @"C:\psap32\BIN";//pfnt。exe程序路径
@+ h: W6 j9 @5 F info.StartInfo.UseShellExecute = false;
, k. ?# y' K( t+ v' T, d9 a info.StartInfo.RedirectStandardInput = true;
+ \2 ?- B, \( s& Z( L( H info.StartInfo.RedirectStandardOutput = true;
& z3 z; b. c6 e3 g* z info.Start();
7 V) E. J! O) ^" P k StreamReader sr = info.StandardOutput;( L& Y, z! `% R* f0 D* W U
StreamWriter sw = new StreamWriter(@"E:\广东电网充裕度评估系统\童—潮流计算程序\powerflow.txt");//生成文档存放位置: R+ }; d. b" D6 B& r8 c' h s9 J2 D$ G. t
sw.Write(sr.ReadToEnd());- r) s( B( }9 v# [
sw.Close();( J0 ]- V$ y, ~4 ~9 U
}
5 c4 N0 ]. V' u; c: o' O }& K# W" \" ^0 g* o5 @5 J$ D+ G
} |
|