From: | Andrew Bell |
Date: | 07 Dec 99 at 15:01:51 |
Subject: | Re: Process/Task confusion |
From: Andrew Bell <andrew.ab2000@bigfoot.com>
Hi Martyn,
On 05-Dec-99 you wrote: [amiga-c] Process/Task confusion
> I'm confused about the capabilities of tasks and processes. For
> example, is it true I can't use dos library functions, or anything
> that may invoke one of those functions from a task?
>
> If I start a program from Workbench (rather than a shell), is it
> running as a task or a process? And if it is running as a task, how
> do I use dos functions from it?
It's running as a process, so you can call any DOS function you wish.
Although the pr_CLI field in the process structure is NULL when
started from WB.
> Finally, what does AllocDosObject() do? The autodocs don't seem to
> help.
It's a routine that allocates and initializes a DOS structure, for
example a FileInfoBlock. Here's a quick example:
BPTR MyLock;
MyLock = Lock("ram:Example-file", SHARED_LOCK);
if (MyLock)
{
struct FileInfoBlock *FIB;
FIB = AllocDosObject(DOS_FIB, NULL);
if (FIB)
{
if (Examine(MyLock, FIB))
{
// now you can access FIB->fib_Size, etc.
}
FreeDosObject(DOS_FIB, FIB);
}
UnLock(MyLock);
}
Regards, Andrew Bell.
+----------------------------------------+
email: mailto:andrew.ab2000@bigfoot.com or
mailto:andrew@ab2000.prestel.co.uk
web: http://www2.prestel.co.uk/ab2000
+----------------------------------------+
Women are great! Every man should own one!!!!!