複製鏈接
請複製以下鏈接發送給好友

dup

鎖定
dup它有多種意義,包括Linux c 函數、C語言函數DUP、彙編指令、化學物質DUP。
中文名
dup
意義1
Linux c 函數
意義2
C語言函數DUP
程序示例
#include <string.h>
所屬庫
io.h

dupLinux c 函數

#include
int dup(int fd);
int dup2(int fd1,int fd2);
兩個均為複製一個現存的文件的描述
兩個函數的返回:若成功為新的文件描述,若出錯為-1;
由dup返回的新文件描述符一定是當前可用文件描述中的最小數值。用dup2則可以用fd2參數指定新的描述符數值。如果fd2已經打開,則先關閉。若fd1=fd2,則dup2返回fd2,而不關閉它。通常使用這兩個系統調用來重定向一個打開的文件描述符。

dupC語言函數DUP

dup函數簡介

函數名: _dup
功 能: 複製一個文件句柄
用 法: int _dup(int handle);
相關函數:_dup2fdopen、freopen、_mbsdup、_wcsdup、_strdup

dup程序示例

#include <string.h>
#include
#include <conio.h>
#include
void flush(FILE *stream);
int main(void)
{
FILE *fp;
char msg[] = "This is a test";
/* create a file */
fp = fopen("DUMMY.FIL", "w");
/* write some data to the file */
fwrite(msg, strlen(msg), 1, fp);
clrscr();
printf("Press any key to flush \
DUMMY.FIL:");
getch();
/* flush the data to DUMMY.FIL without
closing it */
flush(fp);
printf("\nFile was flushed, Press any \
key to quit:");
getch();
return 0;
}
void flush(FILE *stream)
{
int duphandle;
/* flush TC's internal buffer */
fflush(stream);
/* make a duplicate file handle */
duphandle = dup(fileno(stream));
/* close the duplicate handle to flush the
DOS buffer */
close(duphandle);
}

dup彙編指令

dup 在彙編中是一條偽指令,用來重複初始化數據
用法舉例:
str1 db 10 dup ('!@#') ;這就是十個!@#
格式:db 重複的次數 dup (重複的內容)

dup化學物質DUP

DUP是1,2-苯二甲酸二正十一酯,不溶於水,主要是作為增塑劑來使用的,溶於酯類。