OK im no novice with this aspect but for some odd reason, my read procedure isnt doing its job and its rather annoying!
PROCEDURE save_password(user,pword:string; value:longint);
VAR
pin : pword_rec;
pfl : pword_file;
BEGIN
pin.user := user;
pin.pass := pword;
pin.value := value;
assign(pfl,passfile); {constant = 'C:\Data.dat'}
reset(pfl);
seek(pfl,filesize(pfl));
write(pfl,pin);
close(pfl);
END;
That, Im glad to say, works fine. The fact the file size increases is testament to that.
I also have a search procedure that correctly reads the file and does what its meant to with retrieved data...
This however, doesnt work:
PROCEDURE display_users;
VAR
pin : pword_rec;
pfl : pword_file;
y : integer;
s : string;
BEGIN
y := 3;
frame(1,1,80,50);
assign(pfl,userfile);
reset(pfl);
WHILE NOT EOF(pfl) DO
BEGIN
read(pfl,pin);
writexy(2,y,pin.user);
y := y + 1;
str(filezise(pfl),s);
writexy(3,2,s);
END;
END;
S is somehow 1 and no user names are displayed on screen. Im only using the str and filesize to check it works. I know for a fact that there are more than 50 users saved in the file ( i did a repeat loop, adding in users to test another aspect of the program).
This is really puzzling. Can any one explani what's going on please?
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
PROCEDURE save_password(user,pword:string; value:longint);
VAR
pin : pword_rec;
pfl : pword_file;
BEGIN
pin.user := user;
pin.pass := pword;
pin.value := value;
assign(pfl,passfile); {constant = 'C:\Data.dat'}
reset(pfl);
seek(pfl,filesize(pfl));
write(pfl,pin);
close(pfl);
END;
That, Im glad to say, works fine. The fact the file size increases is testament to that.
I also have a search procedure that correctly reads the file and does what its meant to with retrieved data...
This however, doesnt work:
PROCEDURE display_users;
VAR
pin : pword_rec;
pfl : pword_file;
y : integer;
s : string;
BEGIN
y := 3;
frame(1,1,80,50);
assign(pfl,userfile);
reset(pfl);
WHILE NOT EOF(pfl) DO
BEGIN
read(pfl,pin);
writexy(2,y,pin.user);
y := y + 1;
str(filezise(pfl),s);
writexy(3,2,s);
END;
END;
S is somehow 1 and no user names are displayed on screen. Im only using the str and filesize to check it works. I know for a fact that there are more than 50 users saved in the file ( i did a repeat loop, adding in users to test another aspect of the program).
This is really puzzling. Can any one explani what's going on please?
TIA
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."