Dear Christian,
You are doing it quite reasonably, however, please aware of the following
matters.
1. #include should not appear in un-named macro. Please use C++ style
macro or G__loadfile("stdio.h") instead.
#include <stdio.h>
mymacro() {
...
}
------------OR-----------
{ // unnamed macro
G__loadfile("stdio.h");
....
}
2. Cint does not support non-ANSI header files and system calls. In this
case, sys/types and sys/stat.h are not in ANSI. open() is not included
in ANSI/ISO C/C++ either. These libraries are included in POSIX
standard. Cint supports it with unistd.h and posix.dll.
#include <stdio.h>
#include <unistd.h>
f() {
int read, error;
error=open("hello",read,0x100);
printf("Error: %d\n",error);
}
Thank you
Masaharu Goto
>
>Dear Rooters
>
>Last week, I was really in trouble, because I wanted to open a non-ROOT
>binary file in CINT and to fill NTuples with the data.
>
>Finally Michele Weber an me could do it with compiling the ROOT script.
>But I am still not able to use the open-command in CINT.
>
>I can compile the following code with my GNU C++ Compiler on SUN SOLARIS
>and execute the program also:
>
>---
>
>#include <sys/types.h>
>#include <sys/stat.h>
>#include <stdio.h>
>#include <fcntl.h>
>
>main ()
>
>{
> int read, error;
>
> error=open("hello",read,0x100);
> printf("Error: %d\n",error);
>}
>
>---
>
>I cannot execute the following ROOT script in CINT:
>----
>{
>gROOT->Reset();
>
>
>#include <sys/types.h>
>#include <sys/stat.h>
>#include <fcntl.h>
>
>int read, error;
>
>error=open("hello",read,0x100);
>printf("Error: %d\n",error);
>
>}
>----
>
>Why? Is it an including and/or linking problem? #include commands inside
>{ } look terrrible strange. But #include commands outside { } aren't
>working either. Do I make an other mistake?
>
>
>Thanks
>
>Christian
>
>___________________________________________________________________
>Christian Haeberli christian.haeberli@cern.ch
>University of Bern
>Laboratory for High Energy Physics Phone : ++ 41 31 631 4069
>Sidlerstr. 5 Mobile: ++ 41 76 316 6159
>CH-3012 BERN Fax : ++ 41 31 631 4487
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:26 MET