ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (03/23/88)
[ The "Alpha, Beta, Gamma, Diga" joke wasn't mine, by the way... ]
I've bumped into a real poser, and it involves the DOS (as all weird
Amiga problems do).
I have the following code sequence:
--------
savestuff ()
{
register struct frame *this;
long file, dirlock, olddirlock;
int i, here;
char filename[32], err[40], *s;
strcpy (filename, getfile ());
/* Check to see if it currently exists */
if (dirlock = Lock (filename, ACCESS_READ)) {
UnLock (dirlock);
notice (0, "File exists.");
return;
}
/* Create the file... er.. directory */
if (!(dirlock = CreateDir (filename))) {
notice (0, "Couldn't create file.");
return;
}
/* Move to the directory just created to contain the stuff */
olddirlock = CurrentDir (dirlock);
/* Start saving off the data */
if (!(file = Open ("blah blah", MODE_NEWFILE))) {
strcpy (err, "File open failed.");
notice (0, err);
goto bombout;
}
--------
Now, here's the stumper: If I enter a filename of the form "foo"
when prompted by the getfile() routine, everything happens correctly: A
directory is created in the current directory, and the data file is written
inside that directory.
However, if I give a filename of the form "DEV:foo", it will
correctly create the directory, but the data file is written in the same
place i.e. into DEV:foo.
What I want to happen in a general sense is to have this:
1> dir opt a
foo (dir)
datafile
What I'm getting (in the second case) is this:
1> dir opt a
foo (dir)
datafile
That is, 'datafile' and 'foo' are in the same directory. I want
'datafile' to be inside the directory 'foo'.
Any ideas? Any workarounds? Any questions? Any answers? Any
rags, any bones, any bottles today......
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape ihnp4!ptsfa -\
\_ -_ Recumbent Bikes: dual ---> !{well,unicom}!ewhac
O----^o The Only Way To Fly. hplabs / (pronounced "AE-wack")
"Work FOR? I don't work FOR anybody! I'm just having fun." -- The Doctor