2 Answers - Sort by: Date | Rating
This function is used for file descriptor manipulation. It is used for changing the attributes of an opened file. The syntax of this file is as follows:
int fcntl(int file_descriptor, int cmd, int arg)
The header files sys/types, unistd and fcntl have to be included to use this function.
It returns –1 in case of some error however the return on success depends on the value of second argument.
file_descriptor is the file descriptor on which some operation is to be performed.
cmd is some command code that specifies what operation is to be carried out.
Arg is the optional argument and its value depends on the command provided as th second argument. It default value is 0.
It is meant for five purposes.
1. Duplicating file descriptor
2. To obtain or set the file descriptor flags
3. To obtain or set file status flags
4. Get or Set I/O ownership
5. Get or Set record locks
Following are the command codes that are given as the second argument:
F_DUPED is used for duplicating the file descriptor provided as the first argument.
F_GETFD and F_SETFD are used to get/set the file descriptor flags.
F_GETFL and F_SETFL are used to get/set file status flags.
F_GETOWN and F_SETOWN are used to get or set I/O ownership
F_GETLK, F_STELK and F_SETLKW are used for locking records.
int fcntl(int file_descriptor, int cmd, int arg)
The header files sys/types, unistd and fcntl have to be included to use this function.
It returns –1 in case of some error however the return on success depends on the value of second argument.
file_descriptor is the file descriptor on which some operation is to be performed.
cmd is some command code that specifies what operation is to be carried out.
Arg is the optional argument and its value depends on the command provided as th second argument. It default value is 0.
It is meant for five purposes.
1. Duplicating file descriptor
2. To obtain or set the file descriptor flags
3. To obtain or set file status flags
4. Get or Set I/O ownership
5. Get or Set record locks
Following are the command codes that are given as the second argument:
F_DUPED is used for duplicating the file descriptor provided as the first argument.
F_GETFD and F_SETFD are used to get/set the file descriptor flags.
F_GETFL and F_SETFL are used to get/set file status flags.
F_GETOWN and F_SETOWN are used to get or set I/O ownership
F_GETLK, F_STELK and F_SETLKW are used for locking records.
0
0
The basic use of this function is that it offers the control of open file in many different ways for example it supports F_DUPFD etc.
0
0
- How To Create A Java Program That Accepts 3 Numbers (num1, Num2, Num3) And Sort Them In Ascending And Descending Order?
- Who Is Dummy?
- What Are 3 Types Of Flow?
- What Is The Difference Between Declaring Pointer As Int And Char?
- How Do You Make A Spongebob With Regular String?
- What Are The Advantages And Disadvantages Of Representing Between Variable In A Table?
- When Did Uganda Get Its Independence?
- Explain Any Two Advantages Of A Database Systems?
- Explain File Management Systems Using File-based Approach?
- Do You Need Any Qualifications To Be A Model?
- How To Draw Flow Chart To Check Whether Given String Is Palindrome Or Not?
- What Are Different Versions Of Html?
- In An Array Declaration,this Indicates The Number Of Elements That The Array Will Have?
- What Is Needed To Run A PHP Script?
- Writing Of Data To A Transaction Log Is Which ACID Property?
- When Did Japan Get Independence?
- What Is The Main Disadvantage Of Recursion?
- How Are Records Deleted To Ensure The Integrity And Consistancy Of A Database?
- What Is Object Based Logical Model?
- What Is Difference Between Html And Rss Reader?
- What Are The Higher Normal Forms In Database?
- How To Construct A Flowchart That Will Compute And Print The Sum And Average Of Three Numbers?
- What Do I Do On Meez If It Says Your Input Is Not Correct And It Is?
- How Do I Enable Java Script Onto My Browser. My Cellphone Is A LG - LW310?
- What's An Equation For A Line That Has An X-int Of (6,0) And Y-int Of (0,4)?
- What Is The Purpose And Function Of Money?
- What Is Its Heart Function Or Purpose In Our Body?
- Can You Define The Purpose And Function Of Money?
- What Is Themain Purpose And Function Of Currency?
- What Purpose Or Function Mission Statements Have In An Organization?
- What Is The Job/purpose/function Of A Nerve Cell?
- What Is The Function Of Hard Disk Drive And What Is Their Purpose?
- For Logman.exe,can You Explain The Purpose And Function Of This Utility?
- I Would Like To Know If Computers Are Classified By Their Generation, Function Size And Purpose?

New Comment - Comments are editable for 5 min.