Please help me with this simple C question
-
Please please help with this simple Q from a C newbie....I spent hours trying to find the answer online... I want to run this on a linux box. Open a file containing a list of file names and then run a linux commands on each of the list for example: The file contains a list of files names eg: test test1 test2 test3 How do I code in C so that it opens the file and then foreach of the elements do a system command eg: ls in perl it would be something like: #!/usr/local/bin/perl while(<>){ chomp; $cmd="ls $_"; system($cmd); print "$cmd\n"; } Thanks in advance!
-
Please please help with this simple Q from a C newbie....I spent hours trying to find the answer online... I want to run this on a linux box. Open a file containing a list of file names and then run a linux commands on each of the list for example: The file contains a list of files names eg: test test1 test2 test3 How do I code in C so that it opens the file and then foreach of the elements do a system command eg: ls in perl it would be something like: #!/usr/local/bin/perl while(<>){ chomp; $cmd="ls $_"; system($cmd); print "$cmd\n"; } Thanks in advance!
Hi, this is the C# forum, C# is one of the .NET languages. For plain old C you should post on the C++/MFC forum. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Thursday, February 19, 2009 5:47 PM
modified on Sunday, June 12, 2011 8:23 AM