Loading flat files in the comapct framework

  • Thread starter Thread starter Stephen Haunts
  • Start date Start date
S

Stephen Haunts

Hi

Im writing an app for my Orange SPV e200 phone. This app needs to load up a
file when it loads, lets say 'info.dat'

If i try to load this filename with
FileStream fsIn = new FileStream("Info.dat", FileMode.Open,
FileAccess.Read);

When this gets called i get a file not found exception, but if i call that
function with an absolute path of say

"\storage\program files\myapp\info.dat"
 
arse i hit send to early.

here we go again:

Hi

Im writing an app for my Orange SPV e200 phone. This app needs to load up
a
file when it executes, lets say 'info.dat'

If i try to load this filename with
FileStream fsIn = new FileStream("Info.dat", FileMode.Open,
FileAccess.Read);

I get a file not found exception, but if i call that function with an
absolute path of say

"\storage\program files\myapp\info.dat"

The file opens fine. Do you have to specify an absolute path everytime when
using files on the spv phone. I can always get the working path and append
that to any file i need to load, but it just seems a bit odd.

Any info will be gratefully appreciated.

Regards

Steve
 
Windows CE has no concept of current directory - therefore you must specify
all paths absolutely.

Peter
 
Or do something like that:

string AppPath =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetN
ame().CodeBase);

FileStream fsIn = new FileStream(AppPath + "\\" + Info.dat", FileMode.Open,
FileAccess.Read);
 
Back
Top