August 28th, 2013, 01:17 PM
Console.Readline doesn't read correctly strings with spaces
In the following code, I drag into the window a text file, but if the file name contains a space, then the name is not inserted correctly into path string.
What is the problem?
If the text file name contains no spaces, then it is read OK into path.
public static void Main(string args)
string path, pathString2;
if (args.Length == 0)
Console.WriteLine("please drag the txt file to the console\n");
path = Console.ReadLine();
August 30th, 2013, 02:39 PM
Re: Console.Readline doesn't read correctly strings with spaces
It has to do with the dde interaction with the console window. Honestly, I'm surprised you are getting even a partial path.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!