when the string is found, check the character immediately before and after to see if it is a space. If not a space, then the string is not what you want.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
hi i m trying but couldnt able to do the progrm.
the program is in c & its on finding a string from a text file.
so please help me out to doing it:sad:
Sorry, I can not make sense of what is your question or problem.
Could you state it in other words?.
Did you tried the posted code and it didn't work for you? or you are having problems in creating a program that does the same thing?.
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218
hi i m trying but couldnt able to do the progrm.
the program is in c & its on finding a string from a text file.
so please help me out to doing it:sad:
Sure. If you would
1) explain what you've tried
2) show what you've tried ( read this )
3) not hijack someone else's thread -- make your own
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
use fgets() instead of fgetc() and your program will work better and be a lot less complicated.
delete line 5, NULL is defined in standard c header files.
remove the braces on lines 11, 12 and 13. They are not necessary there.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Welcome to the forum, Akshay1.
This thread is 3 years old - how about starting a new one? More specifics of your assignment, would help. Also, what is stopping you from including string.h and using strstr() to find your string in the text file.?
Adak
Nearly a Posting Virtuoso
1,479 posts since Jun 2008
Reputation Points: 425
Solved Threads: 185