[DUG] File handling help in Delphi 5
Vikas...
vikas.image at gmail.com
Wed Dec 5 19:09:51 NZDT 2007
Thanks Harris
your solution solved my problem
On 12/5/07, Kyley Harris <kyleyharris at gmail.com> wrote:
>
> Your problem is that you are calling readln once before the while loop,
> without passing the data to lbuff.. this is reading the first line..
>
> I suggest.. scrapping the assign readln method for..
>
>
> s := TStringList.Create ;
> s.loadfromfile(AFilename)
> for i := 0 to s.count -1 do
> begin
> lbuff := s[i];
> dosomething....
> end;
>
> On Dec 5, 2007 6:34 PM, Vikas... < vikas.image at gmail.com> wrote:
>
> >
> > Hi
> >
> > I am back again. Well i need one help in file handling. May be i sound
> > dump here but i struck up badly at one point here. Ok let me first explain
> > my first situation.
> >
> > I have say 10 files and path is say c:\vikas\file1text upto
> > c:\vikas\file10.text. I am storyng all this in string list
> >
> > ok Here is my sample code
> >
> > /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> > setlength(Ltextfile, (Ftextfilelists.Count));
> > for L1 := 0 to Ftextfilelists.Count-1 do
> > begin
> > AssignFile(Ltextfile[l1],Ftextfilelists[l1]);
> > reset(Ltextfile[l1]);
> >
> > while not Eof(Ltextfile[l1]) do
> > begin
> > Readln(Ltextfile[l1]);
> > while not Eof(Ltextfile[l1]) do
> > begin
> > Readln(Ltextfile[l1],Lbuff);
> >
> > Do something
> >
> > end;-
> >
> >
> > //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
> >
> > heere ftextfilelists is a string list , ltextfile is an dynamic array of
> > textfile
> >
> > Ok my problem here is in Lbuff as u can see i am storing the file
> > information say file1.txt content and inside this file i have say 20
> > rows of information
> >
> > like this
> >
> >
> > (***********************************************************************************
> >
> > 1 a vb ssss sdsdadadasdas asdadadasdasd asdadasdasdasdasd
> >
> > 2 aldkasdk;asdk;alskd;aslkd;alkd;alkd;aslkd;askd;askd;alkd;askd
> >
> > 3 asldkas;dk;asdka;sdk;alsdk;alsdk;aslkd;alskd;alskd;alskd;laskd
> >
> >
> >
> >
> > ***********************************************************************************}
> >
> > Now the problem is the above code takes the value from 2 instead of 1 it
> > ignores the first row of information and this si what confusing me
> >
> > I may be sound stupid here but i will apreciate if anyone suggest me
> > something wrong in my above code logic
> >
> > Thanks
> >
> > Vikas
> >
> >
> >
> >
> >
> >
> >
> > --
> > vikas
> >
> > _______________________________________________
> > NZ Borland Developers Group - Delphi mailing list
> > Post: delphi at delphi.org.nz
> > Admin: http://delphi.org.nz/mailman/listinfo/delphi
> > Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> > unsubscribe
> >
>
>
>
> --
> Kyley Harris
> Harris Software
> +64-21-671-821
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
--
vikas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071205/9594b5a0/attachment.html
More information about the Delphi
mailing list