| Karim Belabas on Sun, 17 Jul 2016 12:38:18 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Reading and Compiling a File |
Hi,
and welcome to PARI/GP !
* Sung Hyun Lim [2016-07-17 09:27]:
> I'm completely new to PARI/GP, so please bear with me for this possibly
> stupid question:
>
> I'd like to have gp execute a .gp file on my computer and I don't know how
> to do this.
>
> (There are such files like bench.gp in the "examples" folder that comes
> along with PARI/GP installation)
>
> It seems like the commands "\r" or "read" both are meant to do this, but if
> i type
>
> read bench.gp
read is a function, taking a character string as input:
read("bench.gp")
If you need to specify a path, use the forward slash '/' to separate
path components (not '\', which is used to "escape" special characters,
e.g. \n for a carriage return) :
read("examples/bench.gp")
On Windows, if you double-clicked on the gp icon, I think that the path
is relative to the position of the gp.exe binary. For testing purposes,
try to dump a file in that same directory, then read it. (If you're not
on Windows, then the path is relative to the directory you started gp
from on the command line.)
> ? \r bench.gp
>
>
> *** error opening input file: `bench.gp'.
>
> *** Break loop: type 'break' to go back to GP prompt
This should work, provided the path is correct.
> break> break
>
>
> ? \r examples\bench.gp
Same, with forward slash:
\r examples/bench.gp
Cheers,
K.B.
--
Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP]
`