|
-
Oct 6th, 2006, 01:58 AM
#1
Re: System.IO.File
Always read the help documentation, especially when things don't work as you expect. 'Create' returned a FileStream, on which you had to create a StreamWriter to write the data to the file. Now that you're calling OpenRead, what do you suppose you have to do to read the data. The help topic for OpenRead even has a code example.
I should point out the CreateText and OpenText methods are better choices for text files because they return StreamWriter and StreamReader objects directly. If you're using .NET 2.0 (please specify your version EVERY time you start a thread) then you might also look at the WriteAllText and ReadAllText methods, which don't require you to explicitly create any I/O objects at all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|