diff options
author | David Neto <dneto@google.com> | 2018-11-19 22:02:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 22:02:07 -0500 |
commit | e390591a28e042872376b9db4de5433b15702c02 (patch) | |
tree | 51fdfcf68fc853d3118cb9a3573b2f1b64190b30 /samples | |
parent | 6296cc53f4608ee06fff0d57a6b266c541f0ca7a (diff) | |
download | amber-e390591a28e042872376b9db4de5433b15702c02.tar.gz |
Windows build support (#71)
Windows build support
* MSVC: Ensure CRT is statically linked into executables
* Use fopen_s on Windows to avoid security warning
* Use std::strtoull and include its header
* Use #if defined(_MSC_VER)
Diffstat (limited to 'samples')
-rw-r--r-- | samples/amber.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/samples/amber.cc b/samples/amber.cc index d5a5d94..b03a3da 100644 --- a/samples/amber.cc +++ b/samples/amber.cc @@ -112,7 +112,12 @@ bool ParseArgs(const std::vector<std::string>& args, Options* opts) { } std::string ReadFile(const std::string& input_file) { - FILE* file = fopen(input_file.c_str(), "rb"); + FILE* file = nullptr; +#if defined(_MSC_VER) + fopen_s(&file, input_file.c_str(), "rb"); +#else + file = fopen(input_file.c_str(), "rb"); +#endif if (!file) { std::cerr << "Failed to open " << input_file << std::endl; return {}; |