⚲
Project
General
Profile
Sign in
Home
Projects
Help
Search
:
DragonFlyBSD
All Projects
DragonFlyBSD
Overview
Activity
Roadmap
Issues
Documents
Files
Repository
Download (433 Bytes)
Bug #1416
» d.c
corecode
, 07/10/2009 08:51 AM
#include
<stdio.h>
int
main
(
void
)
{
FILE
*
f
=
fopen
(
"duptmp"
,
"w"
);
FILE
*
f1
,
*
f2
;
char
line
[
100
];
if
(
f
==
NULL
)
return
(
1
);
fputs
(
"1
\n
2
\n
3
\n
"
,
f
);
fclose
(
f
);
f1
=
fopen
(
"duptmp"
,
"r"
);
if
(
f1
==
NULL
)
return
(
1
);
f2
=
fdopen
(
dup
(
fileno
(
f1
)),
"r"
);
if
(
f2
==
NULL
)
return
(
2
);
fgets
(
line
,
sizeof
(
line
),
f1
);
printf
(
"read1: %s"
,
line
);
fgets
(
line
,
sizeof
(
line
),
f2
);
printf
(
"read2: %s"
,
line
);
return
(
0
);
}
« Previous
1
…
3
4
5
6
Next »
(5-5/6)
Loading...