Trio is a fully matured and stable set of printf and string functions designed be used by applications with focus on portability or with the need for additional features that are not supported by standard stdio implementation.
There are several cases where you may want to consider using trio:
The functionality described in the stdio standards is a compromise, and does unfortunately not include a mechanism to extend the functionality for an individual application. Oftentimes an application has the need for an extra feature, and the application code can become much more clear and readable by using an extension mechanism. Trio supports a range of useful extensions such as user-defined specifiers, passing of arguments in arrays, localized string scanning, thousand-separators, and arbitrary integer bases.
Trio fully implements the C99 (ISO/IEC 9899:1999) and UNIX98 (the Single Unix Specification, Version 2) standards, as well as many features from other implemenations, e.g. the GNU libc and BSD4.
Binary Numbers
Output an integer as a binary number using a trio extension.
trio_printf("%..2i\n", number);
Thousand-separator
Output a number with thousand-separator using a trio extension.
trio_printf("%'f\n", 12345.6);
Fixed Length Array and Sticky Modifier
Output an fixed length array of floating-point numbers.
double array[] = {1.0, 2.0, 3.0}; printf("%.2f %.2f %.2f\n", array[0], array[1], array[2]);
trio_printfv("%!.2f %f %f\n", array);
Localized scanning
Parse a string consisting of one or more upper-case alphabetic characters followed by one or more numeric characters.
sscanf(buffer, "%[A-Z]%[0-9]", alphabetic, numeric);
trio_sscanf(buffer, "%[[:upper:]]%[[:digit:]]", alphabetic, numeric);
Legal Issues
Trio is distributed under the following license, which allows practically anybody to use it in almost any kind of software, including proprietary software, without difficulty.
"Copyright (C) 1998-2001 Bjorn Reese and Daniel Stenberg.
Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER."
Contribute
We appreciate any type of contribution, from ideas over improvements to error corrections.
The project space contains references to bug and feature tracking, mailing-list, and the CVS repository. We prefer communication via the mailing-list, but do not require you to be subscribed, because trio is a small project.
The project space is located at http://sourceforge.net/projects/ctrio/
Contributors
We have received contributions from the following persons (in alphabetic order sorted by surname)