how to save a file in GAP

941 Views Asked by At

Sorry for a simple question. I'm trying to save a file in GAP using LogTo(filename) and load using Read, but it not works. I studied a lot from online GAP books, but could not understand. Any easy way to save the file and reload it again? I'm using window 8.1Pro. Thanks for the help.

1

There are 1 best solutions below

10
On BEST ANSWER

LogTo(filename) will just print everything that you see in your terminal to a file (including output and errors), so you won't be able to read it in.

If you want to store your input to read in later, try InputLogTo(filename) instead.

For example, try:

LogInputTo("test");
G := SymmetricGroup(5);
g := Random(G);

Now quit GAP, restart it, and type

Read("test");

You should find that it works fine, and moreover, the variables $G$ and $g$ are set as they were in the original instance.

Note: You can also replace "test" with any filename, and also a file path if you like.

See the manual for more info!