⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rd.kirby.c

📁 this is a mirrored site c-faq. thought might need offline
💻 C
字号:
/* *  Sample code posted by Lawrence Kirby *  Date: Mon, 02 Mar 98 01:51:38 GMT *  Subject: temporarily reassigning stdout/stderr *  Message-ID: <28182@genesis.demon.co.uk> * *  (Nonportable: uses dup() and dup2() system calls for *  duplicating underlying file descriptors, which are *  present in Unix but not necessarily anywhere else.) */#include <stdio.h>main(){    int    fd;    fpos_t pos;    printf("stdout, ");    fflush(stdout);    fgetpos(stdout, &pos);    fd = dup(fileno(stdout));    freopen("stdout.out", "w", stdout);        f();    fflush(stdout);    dup2(fd, fileno(stdout));    close(fd);    clearerr(stdout);    fsetpos(stdout, &pos);        /* for C9X */    printf("stdout again\n");}f(){printf("stdout in f()");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -