DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(autosprintf.info.gz) Introduction

Info Catalog (autosprintf.info.gz) Top (autosprintf.info.gz) Top (autosprintf.info.gz) Class autosprintf
 
 1 Introduction
 **************
 
 This package makes the C formatted output routines (`fprintf' et al.)
 usable in C++ programs, for use with the `<string>' strings and the
 `<iostream>' streams.
 
    It allows to write code like
 
      cerr << autosprintf ("syntax error in %s:%d: %s", filename, line, errstring);
 
 instead of
 
      cerr << "syntax error in " << filename << ":" << line << ": " << errstring;
 
    The benefits of the autosprintf syntax are:
 
    * It reuses the standard POSIX printf facility. Easy migration from
      C to C++.
 
    * English sentences are kept together.
 
    * It makes internationalization possible. Internationalization
      requires format strings, because in some cases the translator
      needs to change the order of a sentence, and more generally it is
      easier for the translator to work with a single string for a
      sentence than with multiple string pieces.
 
    * It reduces the risk of programming errors due to forgotten state
      in the output stream (e.g. `cout << hex;' not followed by `cout <<
      dec;').
 
Info Catalog (autosprintf.info.gz) Top (autosprintf.info.gz) Top (autosprintf.info.gz) Class autosprintf
automatically generated byinfo2html