Tuesday, December 21, 2010

How to Write/Read a Text File in windows mobile emulator?

i'm using VS 2008. my code are given here..

string path = @"c:\test.txt";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
}
}
using (StreamReader sr = File.OpenText(path))
{
string s = "";

label1.Text="";
while ((s = sr.ReadLine()) != null)
{
label1.Text+=s;
}
}

but error message: Could not find a part of the path 'c: est.txt'.

Though i am using many code from Internet but still i can not write a file and read from this file.I want to create a file if not exists and want to read text from that file but problem is that path.So please help to do that.

Movies 24h | Dmart.vn

No comments:

Post a Comment