Majid
Majid

Reputation: 14253

What is default directory of File.Open?

I have this code:

Stream f = File.Open("data.majid", FileMode.OpenOrCreate, FileAccess.ReadWrite);

Where will be file created?

Upvotes: 6

Views: 15630

Answers (5)

Chris
Chris

Reputation: 1

Additionally:

  • the working directory can be changed in VisualStudio project settings Project | Properties | Debug

  • if you create a shortcut to the application for a user you can specify the "Start in" property

Upvotes: 0

saeed nasehi
saeed nasehi

Reputation: 31

it will store in current directory . that your application will run

e.g :

if you call Directory.GetCurrentDirectory(); it will return :

"C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0"

Upvotes: 0

Soner Gönül
Soner Gönül

Reputation: 98750

From MSDN;

The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

Check out Directory.GetCurrentDirectory

The current directory is distinct from the original directory, which is the one from which the process was started.

Upvotes: 1

bash.d
bash.d

Reputation: 13207

Usually the directory where the process was started from. This is the current working directory.

From MSDN

The current directory is distinct from the original directory, which is the one from which the process was started.

Upvotes: 1

Matt Ball
Matt Ball

Reputation: 359816

From the File.Open MSDN documentation:

The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see GetCurrentDirectory.

Upvotes: 7

Related Questions