| View previous topic :: View next topic |
| Author |
Message |
werdnareid Member
Joined: 06 Aug 2003 Posts: 9
|
Posted: 23/01/05 17:46 Post subject: File parseing |
|
|
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 |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 61 Location: Netherlands
|
Posted: 24/01/05 12:51 Post subject: |
|
|
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 |
|
 |
werdnareid Member
Joined: 06 Aug 2003 Posts: 9
|
Posted: 24/01/05 17:22 Post subject: |
|
|
| Thanks Stefan , i think that will work .. and thanks for the link...it has some greate tips.. |
|
| Back to top |
|
 |
|