Toolkit Tutorial: Advanced Programming
dt_Handle
conversion
,
container1
,
string
,
container2
;
dt_Integer
length
;
char
line
[
256
];
int
i
=
0
;
conversion
=
dt_alloc_conversion
(
DX_CONV_FMT_MDL
,
DX_CONV_FMT_DAY
);
container1
=
dt_alloc_seq
();
file
=
fopen
(
filename
,
"r"
);
while
(
NULL
!=
(
fgets
(
line
,
256
,
file
)))
{
string
=
dt_alloc_string
(
strlen
(
line
),
line
);
dt_append
(
container1
,
string
);
if
(
100
==
++
i
)
{
container2
=
dt_convert
(
container1
);
while
(
NULL_OB
!=
(
string
=
dt_next
(
container
)))
{
value
=
dt_stringvalue
(
&
length
,
string
);
printf
(
"%.*s\n"
,
length
,
string
);
}
i
=
0
;
}
}
fclose
(
file
);