Jennifer Bester
Jennifer Bester

Reputation: 15

Reading file into CLIPS command line

(defrule display_Pap_en_Vleis
    (answerc1 ?answPV)
    (test (integerp ?answPV))
    (test (= ?answPV 1))
  =>
    (open "C:\Users\Jennifer\Desktop\Results.dat" data "r")
    (read "C:\Users\Jennifer\Desktop\Results.dat")
    (close data)
)

Above we have the following CLIPS code. Everything works up until the file queries. When we run the clips program we receive the following:

[ROUTER1] Logical name C:UsersJenniferDesktopResults.dat was not recognized by any routers
[PRCCODE4] Execution halted during the actions of defrule display_Pap_en_Vleis.

We are trying to display a recipe on the CLIPS command line. Can anybody help?

Upvotes: 0

Views: 1151

Answers (1)

Gary Riley
Gary Riley

Reputation: 10757

(defrule display_Pap_en_Vleis
    (answerc1 ?answPV)
    (test (integerp ?answPV))
    (test (= ?answPV 1))
  =>
    (open "C:\\Users\\Jennifer\\Desktop\\Results.dat" data "r")
    (bind ?data (readline data))
    (while (neq ?data EOF)
       (printout t ?data crlf)
       (bind ?data (readline data)))
    (close data)
)

Upvotes: 1

Related Questions