string - what is c++(stream) equivalent of vsprintf? -


consider code sample

/* vsprintf example */ #include <stdio.h> #include <stdarg.h>  void printferror (char * format, ...) {   char buffer[256];   va_list args;   va_start (args, format);   vsprintf (buffer,format, args);   perror (buffer);   va_end (args); }  int main () {    file * pfile;    char szfilename[]="myfile.txt";    int firstchar = (int) '#';     pfile = fopen (szfilename,"r");    if (pfile == null)      printferror ("error opening '%s'",szfilename);    else    {      // file open      fclose (pfile);    }    return 0; } 

i want avoid using new , char* in function printferror, thinking of ostringstream not take arguments in same form vsprintf. there vsprintf equivalent in c++??

thanks

short answer there isn't, boost::format provides missing functionality. typically streams take different approach, if not sure, have basic tutorial on c++ io streams.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -