473,769 Members | 7,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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?

Apr 13 '07 #1
5 1550
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.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

Apr 13 '07 #2
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
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.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

Apr 13 '07 #4
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.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
Apr 13 '07 #5
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.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
Apr 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2760
by: me | last post by:
I have been looking online for a year, and cant find one. I used to use the int86() command in dos command-line mode, but it can't work in linux. I am using Allegro to make my program work, but I need to put it on a floppy, both the kernal and the program. Allegro only works in X-windows, and is commericial anyway. I have tried to figure it out from allegros code, but its too spread out for me to get it all. I just need a small program...
1
4515
by: Yash | last post by:
Hi, Can someone please explain to me what the StreamReader.DiscardBufferedData method does? The documentation says "Use DiscardBufferedData to seek to a known location in the underlying stream and then begin reading from this new point, or to read the contents of a StreamReader more than once." I am not able to understand what exactly this means.
1
3443
by: Chua Wen Ching | last post by:
Hi there, I have some problems when reading XML file. 1. First this, is what i did, cause i can't seem to read "sub elements or tags" values, so i place those values into attributes like this. Before: ----------
4
6206
by: Madhu Gopinathan | last post by:
Hi All, I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor. Each task is processed in a separate thread. Each of the executer threads is an STA thread, and it goes ahead and executes the task. No problems are encountered when tasks are executed one at a time, but when multiple tasks are executed...
2
1670
by: Merdelus | last post by:
I'm a new visual basic learner, I need some help with this program below: create an application that either sums or averagethe rows or columns of a two dimensional array depending on user choices. create a menu bar with a file that includes a perform action command and an exit command. the perform action command computes either the sum or the average of the rows or columns in the array and displays the result in a
0
1540
by: Edwinah63 | last post by:
Hi guys, i am not new to vb6, but a mere tyro in vb.net what i want to do is the following open transaction build an ADODB command object using parameters execute it build another command execute it
4
3899
by: cpptutor2000 | last post by:
Could some C guru help me please? I am using the following program to open a SSH connection to a remote host and eventually run a program on that remote host. #include <stdio.h> #include <stdlib.h> int main(int argc, char* argv){ char command;
0
1094
by: Lemune | last post by:
Hello everyone. I'm creating windows service application to capture data from my PABX, and send the data to sql server. My question is how could my application know when that PABX is sending data and not? I get really confused here. Please check my code and give me some idea or clue or help please :). Thanks in advance. My code is like this: Dim DBConnection As SqlConnection Dim WithEvents SPConnection As SerialPort = New...
1
7729
by: beetle17 | last post by:
Plaintext: a  n i c e  d a y Key: -3 Ciphertext: X  k f Z b  a X v Cipher will accept commands from the user and perform the operations required by the commands. There are three different commands. Key command starts with "K1:"followed by a string as the key. Encryption command starts with "E1:" followed by the plaintext. Decryption command starts with "D1:" followed by the ciphertext to be decrypted. After the user inputs an encryption...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.