Please help with this command

C

choudhary.poorva

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?
 
U

Ulrich Eckhardt

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
 
B

Barry Schwarz

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
 
C

CBFalconer

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
 
F

Flash Gordon

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?
 
D

Default User

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top