Swi Prolog, Read file examples

Viewed 3257

I am new to Prolog but I get the basics. I am having problems reading a file. Here is my file:

16
78 45 12 32 457 97 12 5 731 2 4 55 44 11 999 7 

I want to read it so that I get back the characters as numbers. The first line is the amount of numbers on line 2. The problems are:

1) How to split them on SPACE or NEW LINE character

2) They must be numbers:32, not Strings: "32"

I am using SWI-Prolog.

1 Answers
Related