c#读写txt文件的问题
小左自动化 2013-08-05 04:15:28 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevelopLibrary.Enums;
using DevelopLibrary.DevelopAPI;
using System.IO;
namespace sellopen
{
public class sell : EventStrategyBase
{
FuturesAccount fa = null;//定义一个策略生命周期的变量
StreamWriter outfile = null;
public override void OnStart()//在策略启动时执行,一般用来创建图表,或读取账户信息。
{
outfile = new StreamWriter(@"e:\out2.txt");
}
public override void OnBarOpen()//如果是tick级的,比onTick事件晚一个tick.如果是其他级别,在一个Bar刚建立的时候执行。
{
string str1 = Price + ","+LOW[LOW.Length - 2]+ ","+ "\r\n";
outfile.WriteLine(str1);
}
}
}
请问这个怎么改成txt读写共享模式?就是程序在输出变量到txt时,允许txt被打开。现在好像只能在程序结束时才能打开txt。
然后第二个问题是,麻烦各位大哥帮我把读取txt格式写一下。