/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
std::string result;
char buf[bufsize];
buf[0] = '\0';
- while (std::fgets(buf, bufsize, fp) != NULL)
+ while (std::fgets(buf, bufsize, fp) != nullptr)
{
const size_t length = std::strlen(buf);
result.append(buf, length);
{
}
FileStreamImpl(const char *filename, const char *mode)
- : fp_(NULL), bClose_(true)
+ : fp_(nullptr), bClose_(true)
{
fp_ = std::fopen(filename, mode);
- if (fp_ == NULL)
+ if (fp_ == nullptr)
{
GMX_THROW_WITH_ERRNO(
FileIOError(formatString("Could not open file '%s'", filename)),
}
~FileStreamImpl()
{
- if (fp_ != NULL && bClose_)
+ if (fp_ != nullptr && bClose_)
{
if (std::fclose(fp_) != 0)
{
FILE *handle()
{
- GMX_RELEASE_ASSERT(fp_ != NULL,
+ GMX_RELEASE_ASSERT(fp_ != nullptr,
"Attempted to access a file object that is not open");
return fp_;
}
void close()
{
- GMX_RELEASE_ASSERT(fp_ != NULL,
+ GMX_RELEASE_ASSERT(fp_ != nullptr,
"Attempted to close a file object that is not open");
GMX_RELEASE_ASSERT(bClose_,
"Attempted to close a file object that should not be");
const bool bOk = (std::fclose(fp_) == 0);
- fp_ = NULL;
+ fp_ = nullptr;
if (!bOk)
{
GMX_THROW_WITH_ERRNO(
FILE *TextInputFile::openRawHandle(const char *filename)
{
FILE *fp = fopen(filename, "r");
- if (fp == NULL)
+ if (fp == nullptr)
{
GMX_THROW_WITH_ERRNO(
FileIOError(formatString("Could not open file '%s'", filename)),