By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,106 Members | 1,403 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,106 IT Pros & Developers. It's quick & easy.

Please help with this command

P: n/a
I am new to C programming and learning Commands on Unix for my exam on
Interprocess communication. I would appreciate if anyone can explain
the following command:

int chmod ( const char * pathname, mode_t mode ) ;
What is mode_t in this command?

Apr 13 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ch**************@gmail.com wrote:
I am new to C programming and learning Commands on Unix for my exam on
Interprocess communication. I would appreciate if anyone can explain
the following command:

int chmod ( const char * pathname, mode_t mode ) ;
Firstly, this is not called a command (though a Unix command of the same
name exists) but a function declaration or prototype.
What is mode_t in this command?
Typically, the '_t' is used for a typedef, i.e. it is a typedef for some
other type. What that is, I don't know. Also, I think this function is not
part of the standard C API, but rather one specific to Unix-like systems.
Now, two things:
1. You should be able to just throw this function name at google and get a
result that documents it.
2. Typical on Unix systems, you have so-called manpages. Here, on a Debian
system, chmod is documented via manpages.
3. For those Unix-specific functions there are dedicated newsgroups. If
you're not sure where something comes from and can't find out on your own
you can always ask here though or in e.g. alt.comp.lang.learn.c-c++.

Yes, I didn't answer your main question, but you should rather learn to
find out trivial things like that on your own, such skills are much more
valuable. ;)

Uli

Apr 13 '07 #2

P: n/a
On 13 Apr 2007 08:40:08 -0700, ch**************@gmail.com wrote:
>I am new to C programming and learning Commands on Unix for my exam on
Interprocess communication. I would appreciate if anyone can explain
the following command:
It is not a command. It is a prototype declaration for a function.
>
int chmod ( const char * pathname, mode_t mode ) ;
What is mode_t in this command?
It is a non-standard name for a type. Your implementation has created
this name, probably through either the typedef specifier (more likely)
or the #define directive (less likely).

The documentation for chmod should tell you which header you need to
#include to use the function in your program. The declaration for
that name may be in that header or one of the ones it #includes.
Remove del for email
Apr 13 '07 #3

P: n/a
ch**************@gmail.com wrote:
>
I am new to C programming and learning Commands on Unix for my
exam on Interprocess communication. I would appreciate if anyone
can explain the following command:

int chmod ( const char * pathname, mode_t mode ) ;

What is mode_t in this command?
There is no chmod() in the Standard C language. Try
comp.unix.programmer.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
--
Posted via a free Usenet account from http://www.teranews.com

Apr 13 '07 #4

P: n/a
ch**************@gmail.com wrote, On 13/04/07 16:40:
I am new to C programming and learning Commands on Unix for my exam on
Interprocess communication. I would appreciate if anyone can explain
the following command:

int chmod ( const char * pathname, mode_t mode ) ;
It is not a command, C does not have commands. It is not a statement
either, which is as close as C comes to commands. It is a declaration,
and it declares a function with a prototype. That should be covered in
your C test book.
What is mode_t in this command?
It must be a type that is defined somewhere. It is not part of standard
C though. You could try asking in comp.unix.programmer, but they would
be quite likely to tell you to read your text book and/or man pages
and/or at least make some attempt at searching for the information with
Google (I don't know about your text book, but I know man pages and
Google answer this). After all, why should we do your homework if you won't?
--
Flash Gordon
Apr 13 '07 #5

P: n/a
ch**************@gmail.com wrote:
I am new to C programming and learning Commands on Unix for my exam on
Interprocess communication. I would appreciate if anyone can explain
the following command:

int chmod ( const char * pathname, mode_t mode ) ;
What is mode_t in this command?

This is not standard C. It is POSIX, which is another standard
altogether. A better newsgroup for you would be comp.unix.programmer.

As you are working in UNIX, you need to learn how to use the man pages
that are likely installed on your system. The people there can help you
with that.

Brian
Apr 13 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.