Re: [ROOT] <string> ???

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Aug 26 2003 - 00:20:28 MEST


Hi javier,

  do as first line in the macro:

#include <string>

so CINT knows about C++ strings.

However, there is something wrong with the current CINT version so you
would have to change the last line to:

const char *name1;
name1 = filename1.append(";1").c_str();

Cheers, Fons.



On Mon, 2003-08-25 at 22:21, jgonzalez@hepmail.physics.neu.edu wrote:
> Hi all
> 
> Sorry if this is such a simple question, but I looked in the website and
> didn't see it.
> 
> I'm using root 3.03.05 in Red Hat linux.
> 
> With the following script:
> 
> {
> char* name = "name";
> string filename1 = name;
> const char* name1 = filename1.append(";1").c_str();
> }
> 
> I get:
> 
> root [0]
> Processing str.C...
> Error: Assignment to filename1 type incompatible  FILE:str.C LINE:4
> *** Interpreter error recovered ***
> root [1]
> 
> What kind of string does ROOT think it is? how do I tell it it is the
> standard C++ string? Is it something else?
> 
> Javier
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET