Bill Allombert on Thu, 24 Jul 2014 11:07:39 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Reading files and loading a directory


On Thu, Jul 24, 2014 at 10:16:53AM +0200, Josef Eschgfaeller wrote:
> Is there a possibility to read the complete
> content of a text file as a string?

Yes, you can use readstr() or externstr().

> How can one load all program files
> contained in a directory (without
> explicitly listing them)?
> Probably it works calling for example
> a python program which collects
> all of them and then using extern, but
> can it be done with Pari alone?

Sure, using externstr:
externstr("ls *.gp")
will give you a list of filenames.
Then you can do 
apply(x->read(x),externstr("ls *.gp"))
to read them.

Cheers,
Bill.