Example
char filename[256];
cin >> filename;
FILE *fp = fopen(filename,"r");
Rene Brun
On Sat, 27 Apr 2002, HALASYA SHIVA wrote:
> Dear Rene,
> Sorry, I was out of town, so couldn't reply immediately. I am hereby
> sending the datafile and the script file as attachments.
> " I have one more question, this is a trivial question may be...
> You know we can access files from command line in C++ using argc, argv[]
> declarations in the main, likewise, even in C++ or root, how can I read the
> file name as a string while running the program. means...
> fp = fopen("data.dat","r");
> instead of this, I would like to declare
> char *ar[];
> gets(ar[1]);
> fp = fopen(ar[1],"r"); and then access my file.
> Can I do this or not?
> When I am doing this, its not recognizing the ar[1] value as a file name,
> where am I going wrong? Please reply. Thanx
> Yours,
> Shiva.
>
> On Wed, 17 Apr 2002, Rene Brun wrote:
>
> >Please, send me a small data file + a script showing the problem.
> >
> >Rene Brun
> >
> >On Wed, 17 Apr 2002, Siva Subramania wrote:
> >
> > > Dear Rene,
> > > I dont understand why this happens? First of all, thanx a lot for
> > > helping me in fitting gaussian to ntuples. Now everything is going fine,
> > > but whenever I have a dataset with numbers greater than one and the
> > > range of the data numbers(of 400 data points say) for example lies
> >between
> > > 2.3 to 2.6, and I plot an ntuple and fit, I am getting a mean value of
> > > 0.5 something irrelevant to the data that I am feeding in. But when I
> > > make the numbers to become less than 1,say 0.23 to .26 then I am getting
> > > relevant results ie the mean is now between the range (0.244). Is
> > > that a bug of any of the version b'coz I am using one of the previous
> > > versions of root.Probably 3.00. How can I get around it? Please reply.
> > > Thanx,
> > > yours,
> > > Shiva.
> > >
> >
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET