summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-04-15 22:40:52 +0200
committerCarl Hetherington <cth@carlh.net>2022-05-05 21:46:30 +0200
commit57ee229993937dee8e12df4f60dd1e508fe50622 (patch)
tree195a1d27a9cfc000456beb8edc65f3c09a391ea1 /src
parent85207b59bd065b5fd8d1c7c0302e153dcd941554 (diff)
Add ::puts().
Diffstat (limited to 'src')
-rw-r--r--src/file.cc8
-rw-r--r--src/file.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/file.cc b/src/file.cc
index 8ab50293..bb276d48 100644
--- a/src/file.cc
+++ b/src/file.cc
@@ -120,6 +120,14 @@ File::gets(char *s, int size)
}
+int
+File::puts(char const* s)
+{
+ DCP_ASSERT(_file);
+ return fputs(s, _file);
+}
+
+
File::operator bool() const
{
return _file != nullptr;
diff --git a/src/file.h b/src/file.h
index 037251c1..edc431bd 100644
--- a/src/file.h
+++ b/src/file.h
@@ -71,6 +71,8 @@ public:
int eof();
/** fgets() wrapper */
char *gets(char *s, int size);
+ /** fputs() wrapper */
+ int puts(char const *s);
/** fseek/fseeki64 wrapper */
int seek(int64_t offset, int whence);
/** ftell/ftelli64 wrapper */