Re: current_dir()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Derek Parnell wrote:
> 
> don cole wrote:
> > 
> > Hello Jules,
> > 
> >   As far as I know current_dir() is the diectory of the main program you are
> > running. 
> 
> No it is not!
> 
> In Windows, every process has a set of default directories, one per drive. A
> command line window is a process so therefore it has a set of default dirs.
> The current directory is the default directory of the current drive. It has
> nothing to do whatsoever with which directory a program is stored in.
> 
> For example, if I start a Command line window I get "C:\Documents and
> Settings\Derek>"
> as the prompt. This shows the current directory for the C: drive. If I change
> drives to the D: drive the prompt changes to "D:\" which is that drive's
> current
> directory. If I now start a program that is stored in some other directory
> running,
> the current directory is still D:\ and not the program's location.
> 
> Let's say I have this program ...
> }}}
<eucode>
> include file.e
> printf(1, "%s\n", {current_dir()})
> </eucode>
{{{

> saved as C:\temp\showcd.ex
> 
> In my command window I run this ...
> 
>   D:\> exwc c:\temp\showcd.ex
> 
> The output is "D:\" and not "C:\temp"
> 
> Now let's change that program a little ...
> }}}
<eucode>
> include file.e
> printf(1, "%s\n", {current_dir()})
> constant arg = command_line()
> printf(1, "%s\n%s\n", {arg[1], arg[2]})
> </eucode>
{{{

> 
> And run it again ...
> 
>   D:\> exwc c:\temp\showcd.ex
> 
> The output is now ...
> 
> D:\
> C:\EUPHORIA\BIN\exwc.exe
> c:\temp\showcd.ex
> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> Skype name: derek.j.parnell

Hello Derek,

  I'm sure you are right. I place all Eu programs in the F:\ dir.

 Everytime I use current_dir() it is from one of those programs in F:\.

So I would get F:\something or other. What I don't understand is why would one
 want to call one of those F:\ program from the command line in C:\?

Don Cole

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu