Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a maximum number of characters that can be written using a StreamWriter?

Tags:

Is there a maximum number of characters that can be written to a file using a StreamWriter? Or is there a maximum number of characters that WriteLine() can output? I am trying to write some data to a file but all of the data does not seem to make it. This is the current state of my code:

StreamWriter sw = new StreamWriter(pathToFile);  foreach (GridViewRow record in gv_Records.Rows) {     string recordInfo = "recordInformation";      sw.WriteLine(recordInfo); } 
like image 1000
Josh Mein Avatar asked Oct 02 '08 17:10

Josh Mein


People also ask

How do you write a StreamWriter?

StreamWriter contains methods to write to a file synchronously (Write and WriteLine) or asynchronously (WriteAsync and WriteLineAsync). File provides static methods to write text to a file, such as WriteAllLines and WriteAllText, or to append text to a file, such as AppendAllLines, AppendAllText, and AppendText.

Does StreamWriter overwrite?

StreamWriter(String, Boolean) Initializes a new instance of the StreamWriter class for the specified file by using the default encoding and buffer size. If the file exists, it can be either overwritten or appended to.

Where does StreamWriter write to?

StreamWriter. WriteLine() method writes a string to the next line to the steam. The following code snippet creates and writes different author names to the stream.

Will StreamWriter create a file?

The first step to creating a new text file is the instantiation of a StreamWriter object. The most basic constructor for StreamWriter accepts a single parameter containing the path of the file to work with. If the file does not exist, it will be created. If it does exist, the old file will be overwritten.


1 Answers

Are you calling StreamWriter.Close() or Flush()?

like image 125
itsmatt Avatar answered Oct 01 '22 20:10

itsmatt