Re: [ROOT] parsing input line to root

From: Valeri Fine (fine@bnl.gov)
Date: Wed Jun 19 2002 - 01:05:35 MEST


> Hi Ed,
> 
> Sorrowfully, this is C++ syntax.  In a C++ string '\' is used as an escaped
> character.  You need to first transfer the %1 in doubling the \.
> 
> An alternative is to write a very small C++ program that would
> 
> - tranform argc[1] to double the '\'.

  I agree then you can use system call tostart ROOT
 . . .

#include "TString.h"
int main(argc,argv){
  TString rootCmd = "start root ";
   rootCmd  += argc[1];
   rootCmd.ReplaceAll("\\","/");
   system(rootCmd.Data());
}
     
 Of course instead TString you may use something else.

> - create a string toe say myScript.cpp(\"...")
> - call gROOT->ProcessLine(cmd)

 I think for Windows you can do

  int main(argc,argv){
  

  }
> 
> Cheers,
> Philippe
> -----Original Message-----
> From: owner-roottalk@pcroot.cern.ch
> [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ed Oltman
> Sent: Tuesday, June 18, 2002 9:20 AM
> To: Roottalk@Pcroot. Cern. Ch
> Subject: [ROOT] parsing input line to root
> 
> 
> Hi,
>  I am using root v3.02/07 on Win32.  I have made an OS association of the
> file type .root to launch root using the the following:
> 
> %rootsys%\bin\root %rootsys\myScript.cpp(\"%1\")
> 
> So, for example, when I double click (or type from dos prompt) abc.root, the
> following is exected:
> 
> c:\root\bin\root c:\root\myScript.cpp("c:\analysis01\abc.root")
> 
> 
> So far, so good.  Root reports:
> 
> Processing c:\root\myScript.cpp("c:\analysis01\abc.root")...
> 
> The problem is, somewhere in the depths of the CINT (I lost the thread
> within TCint::ProcessLineSynch) the argument to my script is transformed:
> 
> "c:\analysis\abc.root" --> "c:analysis0bc.root"
> 
> and of course, it does'nt work.  If I could coax windoze into replacing "\"
> with "\\" everywhere, the association would work perfectly.
> 
> Is there a way to instruct CINT not to treat a slash as a special character?
> Thanks.
> 
> Ed Oltman
> 
> 
> 
> myScript.cpp looks like:
> 
> class CManage;
> void myScript(char *fname)
> {
>      gROOT->Reset();
>      gROOT->LoadMacro("myAnalysis.dll");
>      CManage *pM = new CManage;
>      pM->RestoreAnalyzed(fname);
> }
> 
> 
> 



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