Wednesday, November 3, 2010

Write data to a sequential access file

HOW TO: Write data to a sequential access file using StreamWriter
Syntax
streamWriterVariableName.Write(data)
streamWriterVariableName.WriteLine(data)

Example 1
outFile.write(“Hello”)

Result
The string “Hello” is written to the file, the next character written to the file will appear immediatley after the letter “o”.

Example 2
outFile.WriteLine(“Hello”)

Result
The string “Hello” is written to the file. The next character written to the file will appear on the next line.

No comments:

Post a Comment