Phones forum

General discussion

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

by ajoysaha / November 12, 2010 11:50 AM PST

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:\test.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.

Post a reply
Discussion is locked
You are posting a reply to: How to Write/Read a Text File in windows mobile emulator?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How to Write/Read a Text File in windows mobile emulator?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Tip. No drive letter in WM.
by R. Proffitt Forum moderator / November 12, 2010 4:44 PM PST

Since Windows Mobile devices and this WM OS does not have a drive C all your need to do is to drop the drive letter.
Bob

PS. Yes, I have apps I've written on WinMo.

Collapse -
How to Write/Read a Text File in windows mobile emulator?
by ypkumar / July 15, 2011 3:29 PM PDT

Hi,
In windows mobile file path as "\\Program Files\\Projectname\\filename "(ex:"Program Files\\jsonstringpra\\jsonstring.txt"). I add a text file jsonstring to my project and select file and property ser as Copy if newer.
just look at my code:

StreamReader resposeStream = new StreamReader("Program Files\\jsonstringpra\\jsonstring.txt");
parsingstring = resposeStream.ReadToEnd();
label5.Text = parsingstring;

it excutes correctly.

Pavan

Popular Forums
icon
Computer Help 47,885 discussions
icon
Computer Newbies 10,322 discussions
icon
iPhones, iPods, & iPads 3,188 discussions
icon
Security 30,333 discussions
icon
TVs & Home Theaters 20,177 discussions
icon
HDTV Picture Setting 1,932 discussions
icon
Phones 15,713 discussions
icon
Windows 7 6,210 discussions
icon
Networking & Wireless 14,510 discussions

Big stars on small screens

Smosh tells CNET what it took to make it big online

Internet sensations Ian Hecox and Anthony Padilla discuss how YouTube has changed and why among all their goals, "real TV" isn't an ambition.