| | |
help writing a grep program
![]() |
Hi Everyone
I have to write a grep program in C and I am not sure where to start.
I need to use strstr() from the standard library, and get it to work; but I dont know how to do that.
And that's only half the program, the second part is "getting strstr() to do case-insensitive searches"... But the professor says it can't; "you know what happens when you know what verb you need, you know what you need it to do, but it isn't available?... you write it" I am not sure what that means and I have no clue what strstr() means! If someone could just help me get started i would really appreciate it. This is my first time taking programming and It is soooo much harder than I thought!
Thanks In Advance!
I have to write a grep program in C and I am not sure where to start.
I need to use strstr() from the standard library, and get it to work; but I dont know how to do that.
And that's only half the program, the second part is "getting strstr() to do case-insensitive searches"... But the professor says it can't; "you know what happens when you know what verb you need, you know what you need it to do, but it isn't available?... you write it" I am not sure what that means and I have no clue what strstr() means! If someone could just help me get started i would really appreciate it. This is my first time taking programming and It is soooo much harder than I thought!
Thanks In Advance!
strstr is a standard function that searches for occurrances of one string inside another.
This is exactly what grep does at its most basic.
It can indeed not search case insensitive but with a little thinking you will be able to figure out how to use it anyway.
Hint: how do you turn "Hello" into "HELLO"?
Your professor seems like a wise man making that statement. He tells you to first think about how you'd solve the problem rather than sit down and start coding like a maniac.
This is exactly what grep does at its most basic.
It can indeed not search case insensitive but with a little thinking you will be able to figure out how to use it anyway.
Hint: how do you turn "Hello" into "HELLO"?
Your professor seems like a wise man making that statement. He tells you to first think about how you'd solve the problem rather than sit down and start coding like a maniac.
•
•
•
•
Originally Posted by jwenting
strstr is a standard function that searches for occurrances of one string inside another.
This is exactly what grep does at its most basic.
It can indeed not search case insensitive but with a little thinking you will be able to figure out how to use it anyway.
Hint: how do you turn "Hello" into "HELLO"?
Your professor seems like a wise man making that statement. He tells you to first think about how you'd solve the problem rather than sit down and start coding like a maniac.
I would like to sit down and code like a maniac, I understand whta to do but putting it in computer language is hard for me.
![]() |
Similar Threads
- Help Writing Mass IM Program (Java)
- Help in writing a litle program for a friend (Java)
- Need help writing a program for length and with (C++)
- Reading/Writing Management Program (C++)
Other Threads in the C Forum
- Previous Thread: How to share memory between applications?
- Next Thread: List <char *> Problem
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue mysql number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






