setting the default working directory for a console application

G

Guest

Ok, I'm trying to get this sample app
http://msdn.microsoft.com/vcsharp/d...getstart_vcsharp.asp#getstart_vcsharp_topic01

working.

It requires me to specify a file. It turns out that it is defaulting
the application's directory to:
this:
Unhandled Exception: System.IO.FileNotFoundException: Could not find
file 'C:\Do
cuments and Settings\Administrator\Local Settings\Application
Data\Temporary Pro
jects\quicksort\bin\Release\infile'.

but this directory evidently is created when the program starts.

While giving the program absolute paths works, I would like to know how
I could set the default directory to a place where I can actually place
the files so that I can use relative pathnames. When the program aborts
with the above exception, it removes that directory where it expects
the file.
 
C

chanmm

I downloaded the sample from your link and try. It is a console project and
you need to input the source path and destination path for yourself so
shouldn't be a problem.

chanmm
 
C

Carl Daniel [VC++ MVP]

While giving the program absolute paths works, I would like to know
how
I could set the default directory to a place where I can actually
place
the files so that I can use relative pathnames.

See System.Environment.CurrentDirectory

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top