Skip to content

Version History

weigao edited this page Jun 21, 2026 · 3 revisions

Version History

This page records the version history of cfstream.

It summarizes the main changes from version 1.0.0 to the current version.

For the latest release package, see the repository releases page:

Current Version

Current version:

1.3.0

Recommended version:

V1.3.0

Version 1.3.0 is recommended for all users, especially users who need macOS, Linux, or multi-file project support.

Version Summary

Version Release Date Main Changes
1.0.0 2026-04-27 Initial release; C++ header only; Windows-only stream restoration
1.1.0 2026-05-01 Added version query and improved safety behavior
1.2.0 2026-05-17 Added C support; split C++ and C headers; added NULL support for selective redirection
1.3.0 2026-06-19 Added cross-platform console restoration; changed functions to static inline; added C99 check and C++ nullptr support

V1.3.0

Release date:

2026-06-19

Tag:

V1.3.0

Release Type

Cross-platform and major safety update.

This version is recommended for all users.

Main Changes

For both C and C++ versions:

  • Added cross-platform support for restoring standard streams.
  • Replaced Windows-only console restoration with platform-dependent console device selection.
  • Changed functions to static inline to improve header safety in multi-file projects.
  • Kept file stream objects independent in each source file.

For the C++ version, cfs.hpp:

  • Added support for passing nullptr to cfs::cfs() in C++11 and later.
  • Kept NULL fully compatible.
  • Added the internal CFS_NULLPTR compatibility macro.
  • Added platform-dependent console device macros.
  • Updated the version string to 1.3.0.

For the C version, cfs.h:

  • Added a C99 or later standard check.
  • Added platform-dependent console device macros.
  • Changed public functions to static inline.
  • Updated the version string to 1.3.0.

Platform Behavior

Starting from 1.3.0, closecfs() and cfs::closecfs() use different console devices depending on the platform.

Platform Console Device
Windows CON
Linux / macOS / other Unix-like systems /dev/tty

This allows standard stream restoration to work outside Windows, including normal terminal environments on macOS and Linux.

Notes

Cross-platform standard stream restoration is designed for restoring the system terminal.

It should work in normal terminal environments, including terminals such as CLion Terminal.

Some IDE-managed run consoles may not provide a real terminal device. In those environments, stream restoration may not work as expected.

Since C standards earlier than C99 are rarely used today, cfs.h now stops compilation when used in C mode below C99.

If you need to use a C standard older than C99, use an older cfstream version, such as V1.2.0.

V1.2.0

Release date:

2026-05-17

Tag:

V1.2.0

Release Type

Major update.

This version introduced official C language support.

Main Changes

  • Added C language support.
  • Changed the original C++ header extension from .h to .hpp.
  • Added cfs.hpp for C++ projects.
  • Added cfs.h for C projects.
  • Added support for passing NULL to cfs() / cfs::cfs() to skip redirecting a specific stream.
  • Improved language and version detection.
  • Improved safety-related behavior.

Header Changes

Before 1.2.0, cfstream used:

cfs.h

as the C++ header.

Starting from 1.2.0, the headers were separated:

Header Language Purpose
cfs.hpp C++ C++ interface
cfs.h C C interface

Selective Redirection

Starting from 1.2.0, users can pass NULL to skip redirecting one side.

Example:

cfs::cfs("test.in", NULL);

This redirects only input.

cfs::cfs(NULL, "test.out");

This redirects only output.

The same idea is also available in the C version:

cfs("test.in", NULL);
cfs(NULL, "test.out");

Notes

This version still restored standard streams using the Windows console device CON.

For macOS and Linux support when restoring standard streams, use V1.3.0 or later.

V1.1.0

Release date:

2026-05-01

Tag:

V1.1.0

Release Type

Feature and safety update.

Main Changes

  • Added a function to get the version number.
  • Added the internal version string.
  • Added safety-related improvements.
  • Added protection against reopening cppfs while file streams are already open.
  • Updated the version string to 1.1.0.

Added Version Query

This version introduced:

cfs::getversion()

The function returns the cfstream version string.

Example:

std::cout << cfs::getversion() << std::endl;

Added Reopening Protection

This version added a check before opening independent C++ file streams.

If cfs::cin or cfs::cout is already open, cppfs() prints an error message:

Error-from-cfs Already open cppfs,please close first!

Notes

In this version, cfstream was still a C++-only header and still used cfs.h.

Standard stream restoration was still Windows-only.

V1.0.0

Release date:

2026-04-27

Tag:

V1.0.0

Release Type

Initial release.

Main Features

The first version provided a lightweight C++ header for file input and output helpers.

It included:

  • cfs::cfs()
  • cfs::cppfs()
  • cfs::closecfs()
  • cfs::closecppfs()
  • cfs::cin
  • cfs::cout

Header

The first version used:

cfs.h

as a C++ header.

Platform Support

The first version only supported Windows for standard stream restoration.

It restored standard streams using:

CON

Notes

This version was the starting point of cfstream.

It did not yet provide:

  • a version query function
  • official C support
  • separated cfs.h and cfs.hpp
  • cross-platform stream restoration
  • C99 standard checks
  • nullptr support

Compatibility Notes

Header Compatibility

Version C++ Header C Header
1.0.0 cfs.h Not available
1.1.0 cfs.h Not available
1.2.0 cfs.hpp cfs.h
1.3.0 cfs.hpp cfs.h

For modern cfstream usage:

  • Use cfs.hpp for C++ projects.
  • Use cfs.h for C projects.

Platform Compatibility

Version Windows macOS / Linux
1.0.0 Supported Not supported for stream restoration
1.1.0 Supported Not supported for stream restoration
1.2.0 Supported Not supported for stream restoration
1.3.0 Supported Supported for normal terminal environments

Language Compatibility

Version C++ Support C Support
1.0.0 Yes No
1.1.0 Yes No
1.2.0 Yes Yes
1.3.0 Yes Yes

Standard Requirements

Header Version Requirement
cfs.hpp 1.2.0 and later C++98 or later
cfs.h 1.2.0 C language support added
cfs.h 1.3.0 and later C99 or later

Upgrade Recommendations

From V1.0.0 or V1.1.0

Upgrade to V1.3.0.

Important changes:

  • Use cfs.hpp instead of cfs.h for C++ projects.
  • Use cfs.h only for C projects.
  • Update documentation and includes if needed.

Old C++ include:

#include "cfs.h"

Modern C++ include:

#include "cfs.hpp"

From V1.2.0

Upgrade to V1.3.0 if you need:

  • macOS support
  • Linux support
  • safer multi-file header usage
  • C99 standard checking
  • C++11 nullptr support in cfs::cfs()

Recommended Version

For most users, the recommended version is:

V1.3.0

See Also

Clone this wiki locally