Hello all:
I'm developing a C# smart device app in VS2005 for PPC2003 and above.
My program is opening a ini file at the begining which is in the same dir. Problem is that the stream code below thinks the file should be in the root "\" directory. I've tried the @".\" and the ".\\" options to try and specify the same dir as the EXE but still get a file not found exception??? When I put the file in the root "\" directory then it opens the file???
StreamReader sr = new StreamReader("temp.ini", Encoding.ASCII);
Am I missing something here?
Thank you
Marshall
File paths???
6 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted Apr 24, 2007, 12:20 PM EDT
Application.StartupPath will give you the path of the executable; you can append your file name to that.
Marshall16 reputationPosted Apr 24, 2007, 12:40 PM EDT
Is this normal?
Seems kind of extreme just to open a file in the same dir as the EXE???
Appreciate the help!
Thank you
Marshall16 reputationPosted Apr 25, 2007, 3:03 AM EDT
I cannot seem to get Application.startuppath ?
When I type Application in VS2005, I get no options for startup path???
Thank you
Huang Elite6 reputationPosted Apr 28, 2007, 11:59 PM EDT
Marshall16 reputationPosted Apr 30, 2007, 3:18 AM EDT
That works.
Thanks again!
Marshall
Scott LysleRank #49 · 31K reputationPosted Apr 30, 2007, 10:30 AM EDT
The full path was System.Windows.Forms.Application.StartupPath