Writing large text files

Russ1984

Member
Joined
Feb 29, 2008
Messages
9
Programming Experience
Beginner
Hi,

I'm having trouble writing all of a large string to a text file. I have an pdf encoded in MIME's base 64 included in an xml file which I need to store temporarily. I think the problem may be a limit on the capacity of the StreamWriter class but I'm not sure. Here's what I have:

Public Function readPDF(ByVal filename As String) As Boolean
Dim d As New XmlDocument()
Dim sw As New StreamWriter("/temp.txt")
d.Load(filename)
Dim nl As XmlNodeList
nl = d.GetElementsByTagName("Formatted-Report")
sw.Write(nl(0).InnerText)
Return True
End Function

Any help greatly appreciated.
 
You have to close the writer.
VB.NET:
sw.Close()
There is also the Using block that can be helpful:
VB.NET:
Using sw As New StreamWriter("/temp.txt")
  sw.write(...)
End Using
 
Back
Top