Dim filename As String = "c:\path\to\file.txt"
If System.IO.File.Exists(filename) Then
Dim writer As New System.IO.StreamWriter(filename)
writer.Write("Text to write" & vbCrLf) 'Add a newline
writer.close()
End If
using System.Text;
using System.IO;
string filename = "c:\path\to\file.txt";
//'using' structure allows for proper disposal of stream.
using (StreamWriter writer = new StreamWriter(filename"))
{
writer.WriteLine("Text to Write\n");
}
using System;
using System.IO;
public class Program
{
public static void Main()
{
string filePath = "somePath";
if(File.Exists(filePath))
{
Console.WriteLine("Exists");
}
else
...