nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

C question

This is a discussion on C question within the Coding in General forums, part of the Development/Scripting category; You are required to create a program which simulate command grep in Unix. Let us call it grep2. grep2 will ...


Go Back   nixCraft Linux Forum > Development/Scripting > Coding in General

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-05-2006, 03:32 AM
TOP TOP is offline
Junior Member
 
Join Date: Feb 2006
Posts: 4
Rep Power: 0
TOP
Default C question

You are required to create a program which simulate command grep in
Unix. Let us call it grep2. grep2 will take a set of parameters. The first parameter is the
pattern to be searched. The rest of the parameters are just file names. grep2 will search in
each file for those line( that contain( the pattern. The output of grep2 is in the
following format:
filename: the line containing the pattern
Your grep2 needs to check the number of parameters. If the number of parameters is not
correct, grep2 displays its usage. For each specified file name, if grep2 cannot open it for
reading, it displays the error message telling its user the failed file name. You also need
to do any other possible checks.
Since you do not know how many characters there are on each line, you need to
dynamically allocate memory for each line read from a file.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-08-2006, 12:14 AM
Junior Member
 
Join Date: Jul 2006
Posts: 3
Rep Power: 0
mtalexan
Default Homework?

I don't think anyone is interested in doing your homework for you.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
phpmyadmin question paul555 Databases servers 2 07-13-2007 08:27 AM
Squid Question asterisk Linux software 2 05-17-2007 04:52 PM
C question TOP Coding in General 3 03-10-2006 11:08 PM
question TOPHUMAN Shell scripting 1 02-06-2006 01:25 PM
Redirecting question sonaikar Linux software 1 06-25-2005 12:18 AM


All times are GMT +5.5. The time now is 08:03 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36