Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Repition anamoly in dbase program Posted by cybersurfer on 5 Mar 2003 at 8:11 PM
i am using linked lists along with DirectAccessFiles, but when i save i get a repition of the previous data along with the new data that i added.below is my save procedure :

 
Procedure Savelist(firstpointer:listpointer;var cfile:cusrec);
var
currentpointer:listpointer;
Begin
assign(cfile,'C:\Dbase\Vehicles.dat');
rewrite(cfile);
currentpointer:=firstpointer;
WHILE  currentpointer <> NIL DO
begin
write(cfile,currentpointer^.custfield);
currentpointer:=currentpointer^.nextfield
end;
[\code]
Report
Re: Repition anamoly in dbase program Posted by DexterMagnific on 6 Mar 2003 at 1:55 AM
This should normally work !
But never forget to close the file !

Check your procedures that adds entries to the linked list. I think the problem comes from it.
DexterMagnigfic at yahoo.fr

Report
Re: Repition anamoly in dbase program Posted by Phat Nat on 7 Mar 2003 at 3:14 PM
This message was edited by Phat Nat at 2003-3-10 17:23:37

This message was edited by Phat Nat at 2003-3-10 17:23:11

: i am using linked lists along with DirectAccessFiles, but when i save i get a repition of the previous data along with the new data that i added.below is my save procedure :

:  
: Procedure Savelist(firstpointer:listpointer;var cfile:cusrec);
: var
: currentpointer:listpointer;
: Begin
: assign(cfile,'C:\Dbase\Vehicles.dat');
: rewrite(cfile);
: currentpointer:=firstpointer;
: WHILE  currentpointer <> NIL DO
: begin
: write(cfile,currentpointer^.custfield);
: currentpointer:=currentpointer^.nextfield
: end;
[\code]

I don't know what type of file you are using (cusrec), but if it is not text, remember to use  REWRITE(CFILE,1);  If it is text, then it looks as though you're problem is elsewhere.

   Phat Nat







 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.