How can I assure that a file is saved with content?

  • Thread starter Thread starter Ken Sturgeon
  • Start date Start date
K

Ken Sturgeon

In VS2005 I have a loop that grabs all of the html from a number of web
pages and saves them as files on a local drive. While all of the files get
saved, several of the files are empty, although I know there is data in the
StreamWriter that creates the files. What is the best approach to assure
that when the file is saved that it has content before itterating through
the next item in the loop?
 
Ken Sturgeon said:
In VS2005 I have a loop that grabs all of the html from a number of web
pages and saves them as files on a local drive. While all of the files get
saved, several of the files are empty, although I know there is data in
the StreamWriter that creates the files. What is the best approach to
assure that when the file is saved that it has content before itterating
through the next item in the loop?


Typically 'StreamWriter' buffers output. Are you calling its 'Close' or
'Flush' method?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top