How to get a data from text file

Discussions related to Visual Prolog
Steve Lympany
VIP Member
Posts: 119
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany » 17 Oct 2011 8:43


danepa
VIP Member
Posts: 57
Joined: 29 Sep 2011 5:54

Re:

Unread post by danepa » 19 Oct 2011 8:11

Tonton Luc wrote:Hi,
Try this :

Code: Select all

login(Nama,Password) :-     user(Nama, _, _, _, _, Password),     S=string::format("Welcome '%' ",Nama),     vpicommondialogs::note(S),     !. login(Nama,_) :-     S=string::format("sorry but you're not welcome '%'\n...because your name is not in personDB.txt.",Nama),     vpicommondialogs::error(S).
It's not work, it always not found in database.
Daniel

Paul Cerkez
VIP Member
Posts: 202
Joined: 6 Mar 2000 0:01

Unread post by Paul Cerkez » 19 Oct 2011 12:09

couple of quick questions (sometimes the obvious escapes us :oops: ):

1. is the user fact base loaded into memory yet?
2. is the NAMA and PASSWORD variable bound with exactly the values that are stored inthe user fact base?

an extra space or even a different capitalization of letters will cause the search to fail. As your code is written, it requires an exact match of both the NAMA and PASSWORD (to include the character sets used)
AI Rules!
P.

Post Reply