Im trying to save a path into my input varaible, but its not reading my input! Im debugging and its completely skipping the line!
public static void OpenFile(int FileSize)
{
char GetLines = ' ';
char[] FileContents = new char[FileSize];
Console.WriteLine("Enter a Path Name: ");
GetLines = (char)Console.Read();
GetLines = (char)Console.Read(); // Getting No Input Y?
StreamReader MyStream = File.OpenText(GetLines.ToString());
while (GetLines != null)
{
Console.WriteLine(FileContents);
GetLines = (char)MyStream.Read();
}
MyStream.Close();
}
Everything else works fine. This function is being called in Main…
My Goals is still to try and read the contents of the file into an array.
THIS IS NOT A HOMEWORK ASSIGNMENT! =)
You can achieve your goal using Console.Read().
Read here http://msdn.microsoft.com/en-us/library/system.console.read.aspx.