DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File parseing

 
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming
View previous topic :: View next topic  
Author Message
werdnareid
Member


Joined: 06 Aug 2003
Posts: 9

PostPosted: 23/01/05 17:46    Post subject: File parseing Reply with quote

Hi...all

I used the tool name sclist to generate a list of the serviecs on my system. the format of the file looks like this: :

--------------------------------------------
- Service list for Local Machine
--------------------------------------------
stopped Alerter Alerter
stopped Apache Apache
stopped Apache2 Apache2
stopped AppMgmt Application Management

the thing is i need to get each column into three seperate lists
i have tried to use readln ..but i think the way the sclist program made the list prevents me from reading in trree variables ....it gives me one line as one .
Back to top
View user's profile
Stefan
Junior Member


Joined: 27 Sep 2004
Posts: 61
Location: Netherlands

PostPosted: 24/01/05 12:51    Post subject: Reply with quote

Hi,

Two things:

1. Why use a tool, when you can do it yourself: http://www.chami.com/tips/delphi/040698D.html

2. Use something like this:

Code:

procedure TForm1.Button1Click(Sender: TObject);
var
  s: string;
  i,a: integer;
  strings: array [0..2] of String;
begin
  s := 'stopped AppMgmt Application Management';
  a := 0;
  for i := 1 to Length(s) do begin
    if (s[i] = ' ') and (a < 2) then begin
      inc(a);
      Continue;
    end;
    strings[a] := strings[a] + s[i];
  end;
  ListBox1.Items.Add(strings[0]);
  ListBox2.Items.Add(strings[1]);
  ListBox3.Items.Add(strings[2]);
end;
Back to top
View user's profile Send e-mail
werdnareid
Member


Joined: 06 Aug 2003
Posts: 9

PostPosted: 24/01/05 17:22    Post subject: Reply with quote

Thanks Stefan , i think that will work .. and thanks for the link...it has some greate tips..
Back to top
View user's profile
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> Delphi Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group