[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: C question



>-richard@spoiler.demon.co.uk (richard)
>
> I know this is the wrong place to ask, so I've got two questions
> now. What is a good unix/C newsgroup? I think I'm gonna need some

For general C, try comp.lang.c. It's probably the wrong place
for these questions, since they are UNIX specific.

comp.unix.programmer (and perhaps comp.unix.questions) might
be the best place.

> I've got a perl script that checks the permissions and creates
> directories. Now I want to rewrite the script in C. I know nothing
> about checking permissions nor creating directories with C. I don't
> even know if it's possible, so if someone does know how to do this
> or a place that might describe the proceedure I would appreciate the
> assistance.

Check permissions: stat(2) is very general, but access(2) is easier
and probably adequate for your needs:

if (access("some/file", R_OK) == 0)
  printf("Readable\n");

Creating directories: mkdir(2)

If you intend to do more UNIX system programming in C, you should
try to get a decent book. I recommend Stevens: "Advanced Programming
in the UNIX Environment", Addison Wesley.

[And I really should get Debian book suggestions rolling soon...]

-- 
MS-DOS: Micro$oft Denial Of Service. The most popular denial of
service attack. It is commonly disguised as an operating system.
The easiest fix is to install a freenix.


Reply to: