-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfile_writer.cpp
More file actions
46 lines (39 loc) · 846 Bytes
/
file_writer.cpp
File metadata and controls
46 lines (39 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by gosha on 10/26/2021.
//
#include "headers/file_writer.h"
#include <cassert>
#include <cstddef>
#include <string>
#include <fstream>
File_Writer::File_Writer(const char *fn) : file_name(fn) {
fout.open(file_name, std::ios::out);
assert(fout.is_open() && "File openning failure!");
}
File_Writer::~File_Writer() {
fout.close();
}
bool File_Writer::float_writing(const float &f) {
if (fout << f) {
return true;
}
return false;
}
bool File_Writer::sizet_writing(const std::size_t &s) {
if (fout << s) {
return true;
}
return false;
}
bool File_Writer::char_writing(const char &c) {
if (fout << c) {
return true;
}
return false;
}
bool File_Writer::string_writing(const std::string &s) {
if (fout << s) {
return true;
}
return false;
}