欢迎访问趣闻百科网!
首页 >科技 >dup
dup

dup

(信息技术)
dup它有多种意义,包括Linux c函数、C语言函数DUP、汇编指令、化学物质DUP。
dup资料
  • 外文名:dup
  • 程序示例:#include
  • 意义2:C语言函数DUP
  • 所属库:io.h
  • 意义1:Linux c 函数
  • Linuxc函数

    #include

    int dup(int fd);

    int dup2(int fd1,int fd2);

    两个均为复制一个现存的文件的描述

    两个函数的返回:若成功为新的文件描述,若出错为-1;

    由dup返回的新文件描述符一定是当前可用文件描述中的最小数值。用dup2则可以用fd2参数指定新的描述符数值。如果fd2已经打开,则先关闭。若fd1=fd2,则dup2返回fd2,而不关闭它。通常使用这两个系统调用来重定向一个打开的文件描述符。

    C语言函数DUP

    函数简介

    函数名:_dup

    功能:复制一个文件句柄

    用法:int _dup(int handle);

    相关函数:_dup2、fdopenfreopen、_mbsdup、_wcsdup、_strdup

    程序示例

    #include

    #include

    #include

    #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在汇编中是一条伪指令,用来重复初始化数据

    用法举例:

    str1 db 10 dup('!@#');这就是十个!@#

    格式:db重复的次数dup(重复的内容)。

    化学物质DUP

    DUP是1,2-苯二甲酸二正十一,不溶于水,主要是作为增塑剂来使用的,溶于酯类。

  • 上一篇百科:地址线
  • 下一篇百科:载波监听
  • 免责声明:本站部分内容来自于网络或者相关专家观点,本站发表仅供学习参考,如有侵权请联系删除邮箱:lujiutang84414@126.com。