Welcome to Web-News
A Web-based News Reader
Subject Re: chmod and chown in D
From Regan Heath <regan@netmail.co.nz>
Date Thu, 12 Jun 2008 11:56:10 +0100
Newsgroups digitalmars.D.learn

Jacob Carlborg wrote:
> J3nkl3r wrote:
>> Hi all
>> i am trying out gdc and the d lang. Does anyone know how to fix chmod
>> and chown
>> c has sys/stat.h but i don't understand how i can fix chmod in d
>>
>> I want to make a chmod program in D
>>
>> regards
>> /J3nkl3r
>
> The alternative community developed runtime library Tango has a module
> for sys/stat.h.
>
> http://www.dsource.org/projects/tango/docs/current/tango.stdc.posix.sys.stat.html
>
> http://www.dsource.org/projects/tango/wiki/Download

For those who are interested in how you go about doing it or yourself
sys/stat is a fairly simple example to use to describe the process :)

So, have a look at the tango source itself:
http://www.dsource.org/projects/tango/browser/trunk/tango/stdc/posix/sys/stat.d

You'll see that in general if you want to access C functions in D you
need to define them in a D module using "extern (C)".

You need to define any structures they use, constant values they use,
and either import definitions for types they use or define them yourself.

You get all this information from the C headers, you can generally
copy/paste into your D module and then get it working with often only
minor changes.

Regan Heath

Recent messages in this thread
 
-# chmod and chown in D J3nkl3r 11-Jun-2008 06:16 am
.-# Re: chmod and chown in D Jacob Carlborg 11-Jun-2008 07:00 am
..\# Re: chmod and chown in D (Current message) Regan Heath 12-Jun-2008 06:56 am