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))
using (StreamReader sr = File.OpenText(path))
string s = "";

while ((s = sr.ReadLine()) != null)

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.

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

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.


Popular Forums
Computer Help 49,613 discussions
Computer Newbies 10,349 discussions
Laptops 19,436 discussions
Security 30,426 discussions
TVs & Home Theaters 20,308 discussions
Windows 10 360 discussions
Phones 15,802 discussions
Windows 7 7,351 discussions
Networking & Wireless 14,641 discussions


$16,000 used SUVs

Whether you like your SUVs cute or capable, or some blend of the two, we've got a wide variety of choices in Roadshow's first collection of Editors' Used Picks.