[TriLUG] Scripting & C++ question
Mark Freeze
mfreeze at gmail.com
Fri Nov 11 16:43:02 EST 2005
On 11/11/05, Carolinux.com <bobevans19 at gmail.com> wrote:
ls /dir/*.txt | yourCplusPlusProgram
This didn't work for me...
I thought it might be my program so I wrote the following simple
program to test it.
#include <iostream>
#include <fstream>
/* arg_test.cpp */
using namespace std;
int main(int argc, char *argv[])
{
for(int val=0; val<=argc; val++)
cout << argv[val] << endl;
return 0;
}
This ("./arg_test bob carol ted alice") generates:
./arg_test
bob
carol
ted
alice
However this (ls /home/mark/programs/cpp | ./arg_test) only generates:
./arg_test
Any suggestions?
Thanks,
Mark.
More information about the TriLUG
mailing list