Re: using std::system

From: James Dennett (jdennett_at_acm.org)
Date: 10/20/04


Date: Tue, 19 Oct 2004 20:45:53 -0700

Edo wrote:

> Anand Hariharan wrote:
>
>> "Chris \( Val \)" <chrisval@bigpond.com.au> wrote in message
>> news:<2tkh30F1vkjm2U1@uni-berlin.de>...
>>
>>> "Alwyn" <dt015a1979@mac.com.invalid> wrote in message
>>> news:191020041223380836%dt015a1979@mac.com.invalid...
>>> | In article <cl2sit$3ta$1@news-02.connect.com.au>, Edo
>>> | <eddod@eddododod.dod> wrote:
>>> | >
>>> | > I should rewrite this... I understand what the system rutine
>>> takes, but
>>> | > how can I pass variables as filenames here.
>>> |
>>
>>
>>
>> [bunches of good advice pertinent to OP's question snipped]
>>
>> To the OP -
>> Why not simply write code that counts the number of lines in 'infile'?
>> wc may be faster, but having to execute that command, and open the
>> outfile to read the result, and parse it for the number all is going
>> to offset the speed-gains.
>>
>> my $0.02,
>> - Anand
>
> sure, I tried, it worked only if the file size is with in a limit, but
> say you have a file with 2000000 lines or 400Mb the loop to count would
> take a loooooooong time.

That's what wc does, and it's generally written in C.

-- James



Relevant Pages

  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)
  • Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
    (Bugtraq)
  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)
  • Execute Process Task not failing, but not executing the batch comm
    ... I can execute the following command from the windows "Run" prompt and it ... Might I have something set weird in SQL Server? ... server being by default configured to run as localsystem account, ...
    (microsoft.public.sqlserver.dts)
  • Re: IIS 6.0 on Windows Server 2003
    ... If PHP insists on using CMD.EXE to execute the shellcommand on the ... server, then no, you have no choice -- you must give read permissions to the ... this would be a security vulnerability caused by PHP. ...
    (microsoft.public.inetserver.misc)