Please help with this command

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • choudhary.poorva@gmail.com

    Please help with this command

    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?

  • Ulrich Eckhardt

    #2
    Re: Please help with this command

    choudhary.poorv a@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.l earn.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

    Comment

    • Barry Schwarz

      #3
      Re: Please help with this command

      On 13 Apr 2007 08:40:08 -0700, choudhary.poorv a@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

      Comment

      • CBFalconer

        #4
        Re: Please help with this command

        choudhary.poorv a@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.progr ammer.

        --
        <http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
        <http://www.securityfoc us.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

        Comment

        • Flash Gordon

          #5
          Re: Please help with this command

          choudhary.poorv a@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.progr ammer, 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

          Comment

          • Default User

            #6
            Re: Please help with this command

            choudhary.poorv a@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.progr ammer.

            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

            Comment

            Working...