Tuesday, July 28, 2009

Finding a string in a string in c language?

I need help starting this programming...I am not asking fo rthe whole program but just some references( websites or similar programs) I know some things but this is like 3 steps above my level. I am willing though to learn.





PROGRAM DESCRIPTION:





Write a function that takes as input a string containing HTML source code and returns both the # of images referenced in the code and the total screen area (in square pixels) occupied by the images. The function MUST have the following declaration:





int estImageContent(char *pacHTML, long int *pliArea);





EstImageContent() must be able to detect at least the following HTML image "tags"





1. IMG and its associated WIDTH= and HEIGHT= parameters


2. BACKGROUND





You may assume that every IMG tag has a WIDTH= and a HEIGHT= parameter. Note that the value of these parameters may be expressed in either quoted (e.g. WIDTH="768") or unquoted (e.g. WIDTH=768) form. You may also assume that there will be only one BACKGROUND tag in the entire string.





You must also write a main() function that tests estImageContent(). main() should:





1. Prompt the user for an input filename


2. Open the file, read its contents into a string (up to 20000 bytes), close file


3. Call estImageContent()


4. Print the following to the screen:


1. Input filename


2. Estimated # of images


3. Estimated total screen area in square pixels


5. Loop back to prompt

Finding a string in a string in c language?
grep


No comments:

Post a Comment