c# - StreamWriter fails to recognize c:\ in compact .net 2.0 -
i have following code
using (var str = new streamwriter(newfilename)) { foreach (entry entry in this.entries) { str.writeline( string.format( @"""{0}"";{1:yyyy-dd-mmthh:mm:ss};""none""" , entry.data , entry.date ) ); } }
where newfilename = @"c:\asln.csv"
this codes works fine on .net framework 2.0 fails miserably on compact 2.0.
it throws error "could not find part of path '\\c:\\asln.csv'."
so, reason path perpended \\
.
how work around that?
c:\ not exist in compact framework (windows ce). paths need start backslash (\)
so if in root folder path should \asln.csv. make sure file in root. different devices have different rules, , putting file in root not going work on devices.
Comments
Post a Comment