[ROOT] Form and Printf don't print multiple TStrings

From: Ashley Cambrell (ash@freaky-namuh.com)
Date: Fri May 03 2002 - 14:23:55 MEST


Hi All,

This may be my own stupidity but why does this happen:

  *   Version   3.03/04        2 May 2002   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.35, Mar 25 2002
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.

//----- Prints bob smith
root [0] cout << Form("%s %s", "bob", "smith") << endl;  <----- Prints
bob smith
bob smith

//----- Only prints bob
root [1] cout << Form("%s %s", TString("bob"), TString("smith")) << endl;  
bob

//----- Prints bob smith
root [2] Printf("%s %s\n", "bob", "smith");
bob smith

//----- Only prints bob
root [3] Printf("%s %s\n", TString("bob"), TString("smith")); <-----
Only prints bob         
bob

root [4]

I was encoutering this whilst creating sql strings from TString
variables  (ie   TString sql = Form("SELECT * FROM %s WHERE blah = '%s",
tstring_var1, tstring_var2);  )

Is there something I'm missing?

Thanks :-)

Ashley Cambrell



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET