Saturday 31 August 2013

Maximum string length that can be passed in command line argument?

Maximum string length that can be passed in command line argument?

I already saw this question similar ques for SQL
I am passing content of web page as argument to c++ program.
my code is here:
<?php
//sent has value "http://www.paulgraham.com/herd.html"
$url=$_POST['sent'];
$text = file_get_contents($url);
$temp=strip_tags($text);
$output=shell_exec("/home/technoworld/Videos/LinSocket/Modular/x '$temp'");
echo $output;
?>
Which gives output for small content only. Output I get is
most : 1 in : 1 investors : 1 component : 1 2013The : 1 biggest : 1 August
: 1 Dynamics : 1 Herd : 1 Investor : 1 Maximum Occurrences Investor Herd
Dynamics August 2013The biggest component in most investors
While actually it show gives count for each word.
Manually when I execute my program in command line:
./x "string"
It works and gives correct result for first paragraph of
"http://www.paulgraham.com/herd.html" . But it does not pass second and
next para content in argument. It just write it on command line.
How can I pass such a content in argument? For small content it gives
correct output.
getconf ARG_MAX
Argument list allowed for my system is : 2097152

No comments:

Post a Comment