+ 1
why "/" instead of "\"?
I was making a practice program and when I wrote: bool txt = File.Exists(C:\text.txt"); it says "unrecognized escape secuence" but when I write: bool txt = File.Exists(C:/text.txt) it does recognize it. is there a config problem with my PC?
4 odpowiedzi
+ 5
You're using escape-sequence feature (\ starts escape sequence; \n and \r mean new line symbol, \t means tab symbol and so on).
In your case you can write:
bool txt = File.Exists("C:\\text.txt") // escape sequence for \ symbol
Or
bool txt = File.Exists(@"C:\text.txt") // ignores escape sequences
+ 3
wow. thanks!!!
+ 1
thans man!! I'll try it right now!
0
this helped me, thanks @Ivan G