Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

Prolog program to read and write file

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 4224

Prolog program to read and write file.

Code for Prolog program to read and write file in Artificial Intelligence

domains
    file = xinput
predicates
    start
    reading
goal
    clearwindow,
    start.
clauses
    start:-    
        openread(xinput,"data.txt"),
        readdevice(xinput),
        reading.
    reading:-
        readln(X),
        write(X),nl,
        not(eof(xinput)),
        reading.
        
    reading:-
        closefile(xinput).
  
Share: 


Didn't find what you were looking for? Find more on Prolog program to read and write file Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of Prolog program to read and write file is from India.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!