Manipulates a file descriptor.
Compatibility:This function is compatible with the following targets:
|
ANSI
|
EMB/RTOS
|
|
#include <fcntl.h>
int fcntl(int fildes, int cmd, ...);Parameters:
Parameters for this facility are:
This function performs the command specified in cmd on the file descriptor fildes.
Mode
|
Description
|
|---|---|
#include <unix.h>
int main(void)
{
int fd1, fd2;
fd1 = open("mytest", O_WRONLY | O_CREAT);
write(fd1, "Hello world!\n", 13);
/* Write to the original file descriptor. */
fd2 = fcntl(fd1, F_DUPFD, 0);
/* Create a duplicate file descriptor. */
write(fd2, "How are you doing?\n", 19);
/* Write to the duplicate file descriptor. */
close(fd2);
return 0;
}
/*ReslutAfter you run this program,
the file mytest contains the following:
Hello world!
How are you doing?
*/
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000