Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
ce79d3e1
Commit
ce79d3e1
authored
Apr 14, 2012
by
Niels Möller
Browse files
examples/io.c: Made write_file use write_string.
parent
a1b48f8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
ce79d3e1
2012-04-14 Niels Möller <nisse@lysator.liu.se>
* examples/io.c (write_file): Use write_string.
* examples/Makefile.in (base64enc): New target. Also added missing
io.o dependency to several other targets.
...
...
examples/io.c
View file @
ce79d3e1
...
...
@@ -132,28 +132,24 @@ read_file(const char *name, unsigned max_size, char **contents)
}
int
write_
file
(
const
char
*
name
,
unsigned
size
,
const
char
*
buffer
)
write_
string
(
FILE
*
f
,
unsigned
size
,
const
char
*
buffer
)
{
FILE
*
f
=
fopen
(
name
,
"wb"
);
unsigned
res
;
if
(
!
f
)
return
0
;
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
if
(
res
<
size
)
res
=
0
;
size_t
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
return
fclose
(
f
)
==
0
&&
res
>
0
;
return
res
==
size
;
}
int
write_
string
(
FILE
*
f
,
unsigned
size
,
const
char
*
buffer
)
write_
file
(
const
char
*
name
,
unsigned
size
,
const
char
*
buffer
)
{
size_t
res
=
fwrite
(
buffer
,
1
,
size
,
f
);
FILE
*
f
=
fopen
(
name
,
"wb"
);
int
res
;
if
(
!
f
)
return
0
;
return
res
==
size
;
res
=
write_string
(
f
,
size
,
buffer
);
return
fclose
(
f
)
==
0
&&
res
;
}
int
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment