Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Beginner Problem with StreamWriter
Eben Coarsey
Oct 25 2010 1:26 PM
7.5k
Reply
I am using StreamWriter to debug a stock trading program and my code creates the file, but will not write to it. I am sure I am missing something simple. I know the method is being used because the D() command you see writes to a debug window. I am not sure what I am missing but the file is created, but always empty.
public class SterlingDebug : ResponseTemplate
{
StreamWriter writer = new StreamWriter(@"C:\Documents and Settings\ecoarsey\SterlingIssue10222010.txt");
int i = 0; public override void GotTick(Tick tick) {
i++; if (i < 11) { D(tick.ToString()); writer.WriteLine("Tick #: {0}",i); }
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
How to Send Email In Asp.net 2.0
Iterating through generic collections