Hey, Xav, let's say I wanted the console to pop up and I would enter the text myself to be written to the text file. Here's the code I have, but it doesn't seem to be working. The console leaves immediately:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
public class writetext
{
static void Main()
{
//Ask for text to write to buffer
Console.WriteLine("What would you like to write to text file? ");
string buffer = Console.ReadLine();
//Write buffer to textfile
string path = @"C:/Users/MyName/Documents/C# file.txt";
StreamWriter txtwrite = new StreamWriter(path);
txtwrite.WriteLine(buffer);
txtwrite.Close();
}
}