PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Don't like ads?
PRO users
don't see any ads ;-)
Public Pastes
Untitled
HTML 5 | 1 sec ago
Untitled
2 min ago
Sfrd24416re1
11 sec ago
Untitled
13 sec ago
Untitled
14 sec ago
Untitled
15 sec ago
Untitled
16 sec ago
Untitled
18 sec ago
Untitled
By: a guest on
May 12th, 2012
| syntax:
None
| size: 0.25 KB | hits: 20 | expires: Never
download
|
raw
|
embed
|
report abuse
|
print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
Interaction of POSIX file descriptors and C FILEs
FILE* f1 = fopen("a.txt", "r");
int fno = fileno(f1);
FILE* f2 = fdopen(fno, "r");
// is it true?
assert(fileno(f2) == fno);
// does it close only f1 or f2 too?
fclose(f1);
fgetc(f2); // valid?
create a
new version
of this paste
RAW Paste Data
Interaction of POSIX file descriptors and C FILEs FILE* f1 = fopen("a.txt", "r"); int fno = fileno(f1); FILE* f2 = fdopen(fno, "r"); // is it true? assert(fileno(f2) == fno); // does it close only f1 or f2 too? fclose(f1); fgetc(f2); // valid?