How to compile a list of file?

This is a discussion on How to compile a list of file? within the C Programming forums, part of the General Programming Boards category; I have a file name grp.c then i have a list of test file, First i gcc -Wall -o grp ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    49

    How to compile a list of file?

    I have a file name grp.c then i have a list of test file,
    First i gcc -Wall -o grp grp.c

    Then my question is that, what is the command that use to run a list of with grp.c.
    I know that to run 1 file, is to use grp things to find < grp.c

    Thanks in advance
    diana
    diana --> programming is tough

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    46
    Please try to explain what you mean by "then i have a list of test file". That doesn't mean anything to me.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    175
    If you want to cmpile list of files then better write makefile..

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,540
    Here's a tip - paste your actual code, actual commands and actual output.

    > I have a file name grp.c then i have a list of test file,
    So for example,

    you do this for one test file
    grp test1.txt

    you do this for many test files
    grp test*.txt

    you do this for a list of test files
    ls test*.txt > list.txt
    grp `cat list.txt`
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    Complete the implementation of grp program so that it implements the following features:

    * ability to read input from a list of files specified on the command line (note that it must display the file name for any matching lines)
    * the -v option to print lines that do not match the pattern
    * the ^ anchor to indicate that the string should appear at the beginning of the line
    * the $ anchor to indicate that the string should appear at the end of the line.



    This is what i am suppose to do for my homework.
    So how can i compile and test my program.

    This is use to compile and run for one file:
    compile the program via the command:

    % gcc -Wall -o grp grp.c

    You can then test it by running the executable on its own source code via the command:

    % grp abc < grp.c
    % grp line < grp.c
    Last edited by dianazheng; 10-17-2004 at 12:51 AM.
    diana --> programming is tough

  6. #6
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,163
    ability to read input from a list of files specified on the command line (note that it must display the file name for any matching lines)
    You're not going to get that by redirecting stdin. What your instructor wants you to do is allow someone to type like:

    grp searchstring file1 file2 file3

    That way your search string is the first argument and every argument after that is a file to search for the string in. If you're still confused look at the man page for grep...it's the same sort of thing.
    If you understand what you're doing, you're not learning anything.

  7. #7
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    Ahh, get it, thanks
    diana --> programming is tough

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  3. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 01:29 AM
  4. Replies: 6
    Last Post: 03-02-2005, 01:45 AM
  5. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 05:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21