TIP: Click on subject to list as thread! ANSI
echo: cis.general_interest
to: 76510,2203
from: David Breeding 72330,2051
date: 1993-05-08 20:12:45
subject: get pwd in `C`

#: 18065 S1/General Interest
    08-May-93  20:12:45
Sb: get pwd in "C"
Fm: David Breeding 72330,2051
To:  76510,2203

  Some time ago, someone - and to the best of my recollection it was you...
asked about how to get the current working directory for usage by a program.
This was something that I was also interested in, but as I remember, no one
came up with a really elegant way of doing it.
   Of course, I suppose that by now, you probably have resolved the problem in
some way, I think that I have stumbled across a pretty acceptable solution.
  Last night, in reviewing "OS9 Insights", in the section on pipes, the answer
was there.  I'm using OSTerm and don't have an ASCII upload ability, so I'll
just briefly go over the algorithm.  I'm using a CoCo, not yet having graduated
to OSK, but most things should be similar.. Here goes..

  int savout,pippth,pthsz;

 pippth=open("/pipe",READ+WRITE);
 savout=dup(1); close(1); dup(pippth);
 os9fork("pwd"....);   from "INsights", OSK calls it a little differently
      from OS9
 pthsz = readln(pippth,wdir,sizeof(wdir)) (Wdir is defined as char wdir[?]
 wdir[pthsz-1] = '\0';   to get rid of cr sent by pwd
  .....cleanup....

  As I said, this may be too little too late, but it seems to be a pretty neat
solution.

 >> David <<

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.